Generating network manager

Example below shows how to initialize JSON-RPC network manager, and redirect all logs to standard debug console.

public sealed partial class MainPage : LayoutAwarePage
        private readonly JsonRpcController networkManager;

        public MainPage ()

			JsonRpcController networkManager = new JsonRpcController("", "12345", true);
			networkManager.NewLog += NetworkManagerLog;

        private void Log(string text)
			Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => { Debug.WriteLine(text); });});


Network manager will initialize, and connect to the remote server on first send request, but you can force that process by using InitAsync(), like in the example below:

        private async void ConnectButtonClick(object sender, RoutedEventArgs e)
            await networkManager.InitAsync();           


You can configure several public JsonRpcController variales such as:
  • RecieveBufferLength
    • Specifies recieve stream buffer length
  • RequestTimeout
    • Sent messages timeout (in ms)
  • MaximumBufferLength
    • Maximum length of a single JSON-RPC message (JSON-RPC RT is merging messages splitted by TCP)

Last edited Dec 3, 2012 at 10:13 PM by axadiw, version 3


No comments yet.