This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

WebSocket Client 'Forcibly Closing' Connection  RSS feed

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am attemting to use WebSockets for the first time, server-side using Tomcat, and client-side using 'Java-WebSocket' (https://github.com/TooTallNate).  The client application successfully connects to the Tomcat hosted webapp, sends it a serialised object (WebSocketConnectionRequest), but by the time the webapp responds a few seconds later with a serialised object of its own (WebSocketConnectionResponse) the client appears to have closed the connection.

Is there anyone here who has perhaps used the 'Java-WebSocket' library, and can explain why it is forcibly closing the connection rather than waiting to receive the ByteBuffer response?

Below is a log excerpt from the server-side webapp.  It seems to be a time out thing, as once in a while the client remains connected just long enough to receive and process the server response.

 
Christopher Dodunski
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again.

Is there anyone here who has perhaps used the 'Java-WebSocket' library?

I've not yet found an explanation or solution to this problem.

Thanks,

Chris.
 
Saloon Keeper
Posts: 5130
135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not familiar with that particular library, but have you gotten web sockets to work at all with your server setup? If not, a simple client/server example web app (for both web sockets and server-sent events) can be found at https://coderanch.com/t/685060/java/web-app-Server-Events-SSE
 
Christopher Dodunski
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:I'm not familiar with that particular library, but have you gotten web sockets to work at all with your server setup? If not, a simple client/server example web app (for both web sockets and server-sent events) can be found at https://coderanch.com/t/685060/java/web-app-Server-Events-SSE



Hi Tim,

Yes, the connection initially works, but quickly closes.  The whole idea of using web-sockets is to keep connections open so that the server can push data to the client as and when needed, so a little annoying that it keeps closing.  I'm thinking it must be a configuration oversight.  I was expecting the library to work straight out of the box.

I'll take a look at the code you linked to for some clues, and change libraries if necessary.

Thanks,

Chris.
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!