Exemplo n.º 1
0
 public async Task SendMessageAsync(string text)
 {
     if (_client == null)
     {
         throw new InvalidOperationException("Faild to emit, websocket is not connected yet.");
     }
     await _client.SendInstant(text);
 }
Exemplo n.º 2
0
        public async Task <IObservable <PwRpc> > EnterWorld(string serverAddr, Account account)
        {
            var cmd = api.EnterWorld(serverAddr, account);

            Console.WriteLine(cmd);
            await client.StartOrFail();

            await client.SendInstant(cmd);

            return(client.MessageReceived.Select(msg => api.ParseEvent(msg.Text)));
        }
        public async Task SendMessageAsync(string text)
        {
            if (_client == null)
            {
                throw new InvalidOperationException("Faild to emit, websocket is not connected yet.");
            }
            await _client.SendInstant(text);

#if DEBUG
            Trace.WriteLine($"⬆ {DateTime.Now} {text}");
#endif
        }
Exemplo n.º 4
0
        protected async Task SendAsync(string message)
        {
            EnsureConnected();
            await _wsLock.WaitAsync().ConfigureAwait(false);

            try
            {
                EnsureConnected();
                await WsClient.SendInstant(message).ConfigureAwait(false);

                MarkLastSentTs();
            }
            finally
            {
                _wsLock.Release();
            }
        }
Exemplo n.º 5
0
 protected override void CallService(string data)
 {
     websocket.SendInstant(data);
 }
Exemplo n.º 6
0
        /// <inheritdoc />
        public async Task ConnectAsync()
        {
            await _webSocket.Start();

            await _webSocket.SendInstant("[5, \"OnJsonApiEvent\"]");
        }
Exemplo n.º 7
0
 public void Send(Message message) => _client.SendInstant(message.Serialize());