当前位置: 首页>>代码示例>>C#>>正文


C# WebSocketServer.AddService方法代码示例

本文整理汇总了C#中WebSocketServer.AddService方法的典型用法代码示例。如果您正苦于以下问题:C# WebSocketServer.AddService方法的具体用法?C# WebSocketServer.AddService怎么用?C# WebSocketServer.AddService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebSocketServer的用法示例。


在下文中一共展示了WebSocketServer.AddService方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

 public void SetUp()
 {
     server = new WebSocketServer(URI.Port);
     server.AddService<Echo>(URI.AbsolutePath);
     server.Start();
     handle = new EventWaitHandle(false, EventResetMode.AutoReset);
 }
开发者ID:wsky,项目名称:top-link,代码行数:7,代码来源:WebSocketChannelTest.cs

示例2: Main

        public static void Main(string[] args)
        {
            /* Single service server
              //var wssv = new WebSocketServiceHost<Echo>("ws://localhost:4649");
              var wssv = new WebSocketServiceHost<Echo>("ws://localhost:4649/Echo");
              //var wssv = new WebSocketServiceHost<Echo>("ws://localhost:4649/エコー");
              //var wssv = new WebSocketServiceHost<Echo>(4649);
              //var wssv = new WebSocketServiceHost<Echo>(4649, "/Echo");
              //var wssv = new WebSocketServiceHost<Echo>(4649, "/エコー");
              //var wssv = new WebSocketServiceHost<Chat>("ws://localhost:4649");
              //var wssv = new WebSocketServiceHost<Chat>("ws://localhost:4649/Chat");
              //var wssv = new WebSocketServiceHost<Chat>("ws://localhost:4649/チャット");
              //var wssv = new WebSocketServiceHost<Chat>(4649);
              //var wssv = new WebSocketServiceHost<Chat>(4649, "/Chat");
              //var wssv = new WebSocketServiceHost<Chat>(4649, "/チャット");
              //wssv.Sweeped = false; // Stop the Sweep inactive session Timer.

              wssv.Start();
              Console.WriteLine(
            "WebSocket Service Host (url: {0})\n  listening on address: {1} port: {2}\n",
            wssv.Uri, wssv.Address, wssv.Port);
               */

              /// Multi services server
              var wssv = new WebSocketServer(4649);
              //var wssv = new WebSocketServer("ws://localhost:4649");
              //wssv.Sweeped = false; // Stop the Sweep inactive session Timer.
              wssv.AddService<Echo>("/Echo");
              wssv.AddService<Chat>("/Chat");
              //wssv.AddService<Echo>("/エコー");
              //wssv.AddService<Chat>("/チャット");

              wssv.Start();
              Console.WriteLine(
            "WebSocket Server listening on port: {0} service path:", wssv.Port);
              foreach (var path in wssv.ServicePath)
            Console.WriteLine("  {0}", path);
              Console.WriteLine();

              Console.WriteLine("Press any key to stop server...");
              Console.ReadLine();

              wssv.Stop();
        }
开发者ID:gloopsdnnguyen,项目名称:websocket-sharp,代码行数:44,代码来源:Program.cs

示例3: StartWebSocketServer

	void StartWebSocketServer() {
		// Multi services server
      wssv = new WebSocketServer(4649);
	  wssv.AddService<GetColor>("/GetColor");	
				
      wssv.Start();
      print(
        "WebSocket Server listening on port:" + wssv.Port + " service path:");
      foreach (var path in wssv.ServicePaths)
        print("  " + path + "\r\n");
	}
开发者ID:nermakov777,项目名称:Unity_Tests,代码行数:11,代码来源:WebSocketsDemo.cs

示例4: TestFixtureSetUp

 public void TestFixtureSetUp()
 {
     server = new WebSocketServer(URI.Port);
     server.AddService<Server>(URI.AbsolutePath);
     server.Start();
 }
开发者ID:wsky,项目名称:top-link,代码行数:6,代码来源:EndpointTest.cs

示例5: initial_web_socket_server

 void initial_web_socket_server()
 {
     wssv = new WebSocketServer(4646);
     wssv.AddService<GPS>("/gps");
     //wssv.AddService<UHF>("/uhf");
     wssv.Start();
 }
开发者ID:ssor,项目名称:iotlab-native,代码行数:7,代码来源:mainForm.cs


注:本文中的WebSocketServer.AddService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。