コード例 #1
0
        private void notifyWebSocket(string type, object Object)
        {
            ensureConnected();

            //if (localSession != null && localSession.isOpen()) {
            if (localSession != null && localSession.Connected)
            {
                try {
                    WebSocketJsonObject jsonObject = new WebSocketJsonObject(type, Object);
                    //string json = gson.toJson(jsonObject);
                    string json = jsonObject.ToString();
                    //localSession.getBasicRemote().sendText(json);
                    localSession.Send(json);
                } catch (IOException e) {
                    Logger.Error("Error sending data to websocket", e);
                }
            }
        }
コード例 #2
0
	private void notifyWebSocket(string type, object Object) {
		ensureConnected();
		
		//if (localSession != null && localSession.isOpen()) {
        if (localSession != null && localSession.Connected) {
			try {
				WebSocketJsonObject jsonObject = new WebSocketJsonObject(type, Object);
				//string json = gson.toJson(jsonObject);
                string json = jsonObject.ToString();
				//localSession.getBasicRemote().sendText(json);
                localSession.Send(json);
			} catch (IOException e) {
				Logger.Error("Error sending data to websocket", e);
			}
		}
	}