Win a copy of Spring in Action (5th edition) this week in the Spring 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

onMessage method of websocket client endpoint stopping after message received  RSS feed

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

I have a websocket java client connecting to a server to read back the messages from that server. The onMessage method does appear to be obtaining the messages from the server but I noticed an issue when I added further code within the same method. In my case I wanted to log the messages to a database but noticed the database code was not being executed. I removed the database code and put in some println debug and found out that they were not always being executed or that some were but others were not.I also added a for loop which too should complete but stops before the end at differing points, I have the onError and onClose methods implemented and they are not being fired by any error or socket closure. I have included the client code below. Has anyone else encountered this? I'm running jdk 7 and I'm really puzzled by this.

I've got no option but to sell you all for scientific experiments. Or a tiny ad:
Download Free Java APIs to Work with Office Files and PDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!