예제 #1
0
        public SimpleServer()
        {
            ITransport websocketTransport = new WebSocketTransport();
            TransportRegistry.Instance.RegisterTransport(websocketTransport);

            IProtocol jsonRpc = new JsonRpcProtocol();
            IProtocol fivesJson = new FiVESJsonProtocol();
            ProtocolRegistry.Instance.RegisterProtocol(jsonRpc);
            ProtocolRegistry.Instance.RegisterProtocol(fivesJson);

            SINFONIServer newServer = new SINFONIServer("localhost", 8080, "/service/", "server.sinfoni");
            var service = newServer.StartService("127.0.0.1", 34568, "/service", "ws", "jsonrpc");

            service.OnNewClient += new NewClient(HandleNewClient);
            service["example.addVectors"] = (Func<Vector, Vector, Vector>)addVectors;

            Console.Read();
        }
 private void RegisterModules()
 {
     var JsonRPCProtocol = new JsonRpcProtocol();
     var FiVESJsonProtocol = new FiVESJsonProtocol();
     var WebsocketTransport = new WebSocketTransport();
     KIARA.ProtocolRegistry.Instance.RegisterProtocol(JsonRPCProtocol);
     KIARA.ProtocolRegistry.Instance.RegisterProtocol(FiVESJsonProtocol);
     KIARA.TransportRegistry.Instance.RegisterTransport(WebsocketTransport);
 }