This project is read-only.

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 ()
        {
            InitializeComponent();

			JsonRpcController networkManager = new JsonRpcController("http://example.com", "12345", true);
			networkManager.NewLog += NetworkManagerLog;
        }

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

Initialization

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();           
        }

Configuration

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 11:13 PM by axadiw, version 3

Comments

No comments yet.