예제 #1
0
        static void Main(string[] args)
        {
            WsStickyConnector connector = new WsStickyConnector(TimeSpan.FromMilliseconds(20));

            connector.AddHost("ws://127.0.0.1");
            connector.Connected    += Connector_Connected;
            connector.Disconnected += Connector_Disconnected;
            connector.Run();

            while (true)
            {
                connector.Send("Hello world!");
                Console.ReadLine();
            }
        }
예제 #2
0
 /// <summary>
 /// Creates new connection event wrapper
 /// </summary>
 public ExceptionEventMapper(WsStickyConnector connector, Action <Exception> action)
 {
     _connector = connector;
     _action    = action;
 }
예제 #3
0
 /// <summary>
 /// Sends string websocket message
 /// </summary>
 public static async Task <bool> SendAsync(this WsStickyConnector connector, string message)
 {
     return(await SendInternalAsync(connector, message));
 }
예제 #4
0
 /// <summary>
 /// Sends string websocket message
 /// </summary>
 public static bool Send(this WsStickyConnector connector, string message)
 {
     return(SendInternal(connector, message));
 }