Ejemplo n.º 1
0
        private Task SendAsync(WebSocket webSocket, string type, object data)
        {
            long elapsed = _stopwatch.ElapsedMilliseconds;
            Task task    = webSocket.SendAsync(GoodsResponse.GetArraySegment(type, data, elapsed - _latestElapsed), WebSocketMessageType.Text, true, CancellationToken.None);

            _latestElapsed = elapsed;
            return(task);
        }
Ejemplo n.º 2
0
        public static ArraySegment <byte> GetArraySegment(string type, object data, long elapsed)
        {
            GoodsResponse response = new GoodsResponse(type, data, elapsed);

            return(response.GetArraySegment());
        }