Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F14E18A40 for ; Mon, 10 Aug 2015 14:01:29 +0000 (UTC) Received: (qmail 39065 invoked by uid 500); 10 Aug 2015 14:01:08 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 39007 invoked by uid 500); 10 Aug 2015 14:01:08 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 38996 invoked by uid 99); 10 Aug 2015 14:01:08 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Aug 2015 14:01:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 00DF5DBECF for ; Mon, 10 Aug 2015 14:01:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.999 X-Spam-Level: X-Spam-Status: No, score=0.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H2=-0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Z8_pBLbGmcHd for ; Mon, 10 Aug 2015 14:01:07 +0000 (UTC) Received: from mail-ob0-f175.google.com (mail-ob0-f175.google.com [209.85.214.175]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 199C8428CC for ; Mon, 10 Aug 2015 14:01:07 +0000 (UTC) Received: by obnw1 with SMTP id w1so123939952obn.3 for ; Mon, 10 Aug 2015 07:01:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=OINqtwJkMoXDzxf0cSULEClLpxlo9w+dGL/MVNAYsd0=; b=j9rxENM4TxS/xjtBm8sSRB33/2+dmOgcKkmNyUdtjlK2YlsSszQJITCkek9Gd7+oim y1fwu3yH5Xyocxw9xJ58XcAPBDh6PieC1od6eEH0ISBykrBhfJ1+H7JtzsW0ED+bGGPA /vZGi73+vGOnLBJ5T3Sgvx3d7sCfjB6zXdHX4xrrqEecnO/SWk0IxvDnnRpycjzVqGiM KjYX6LGocFDiYf11lQ71gsQwQTil1ZH+o+jNdRLcKm37CnPxl/FafFlAKCdfcKLMCGlP UScvDw5BrpZCiHdd3mQXyvD2FvtS2remyTwPCOSrogSwXEnj8mKg/3b96pYbgUzMFaeN zO5g== X-Gm-Message-State: ALoCoQnlNvaxWQapyrDaixDbjdjKhiC/bJvhGkxVF4+NfBL9Qjv6rMfiP8Eerh4MVeAUKUXnUhyg MIME-Version: 1.0 X-Received: by 10.60.141.135 with SMTP id ro7mr19181259oeb.13.1439215266512; Mon, 10 Aug 2015 07:01:06 -0700 (PDT) Received: by 10.202.136.1 with HTTP; Mon, 10 Aug 2015 07:01:06 -0700 (PDT) Date: Mon, 10 Aug 2015 10:01:06 -0400 Message-ID: Subject: Send a message from java application to a specific websocket session via Tomcat websocket server From: Jason Ricles To: Tomcat Users List Content-Type: text/plain; charset=UTF-8 Introduction: I have an application that uses a webpage as the GUI and the backend is written in Java so thuswebsockets using Apache Tomcat 7 are the way I am communicating between the GUI and the backend code that does all the grunt work. A websocket server is the go between, between the backend code and the GUI part of the application. Here is the flow of the communication. >From GUI to backend: GUI-->WebSocketServer-->Backend >From backend to GUI: Backend-->WebSocketServer-->Backend Problem: The problem I am wanting to solve, is if a user request an action to be done on the GUI and then an error is encountered I want only that specific user to get an error message not everyone connected to the site that is the GUI. The only feasible way I can think of doing this right now, is sending the session ID of the user requesting the action as part of the websocket message and then storing that using ID corresponding to the action requested in something like a HashMap. Then if there is an error while performing the requested action put some logic in the websocket server code to extract the session ID from the message being sent back to the GUI and send the error message to this specific session. Question: My question is, is there any simplier way to do this of sending a message to a specific user between ajava back end and a web page front end that communicate using web sockets, or is this the only way possible to achieve what I am trying to do? --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org