コード例 #1
0
        public void ConnectionEstablished(JSONObject dataJSON)
        {
            State        = "connected";
            ConnectionId = dataJSON["connection_id"].str;
            connection.FlushQueue(ConnectionId);

            JSONObject frame = new JSONObject();

            frame.Add("connection_opened");
            frame.Add(new JSONObject());

            WebSocketRailsEvent openedEvent = new WebSocketRailsEvent(frame);

            Dispatch(openedEvent);
        }
コード例 #2
0
        public void ConnectionEstablished(Object data)
        {
            state = "connected";
            if (data.GetType() == typeof(JObject))
            {
                Dictionary <String, Object> infoDictionary = ((JObject)data)
                                                             .ToObject <Dictionary <String, Object> >();

                ConnectionId = (String)infoDictionary["connection_id"];
                connection.FlushQueue(ConnectionId);

                List <Object> frame = new List <Object>();
                frame.Add("connection_opened");
                frame.Add(new Dictionary <String, Object>());

                WebSocketRailsEvent openedEvent = new WebSocketRailsEvent(frame);
                Dispatch(openedEvent);
            }
        }