Add missing listener JSON diagnostics call. Check that the diagnostics_json function exists before calling it. As the protocol modules don't have diagnostics functions, they aren't called. Replace hard-coded strings with constant parameters. This makes it slightly cleaner.