Over a million developers have joined DZone.

Optimized WebSocket Broadcast

DZone's Guide to

Optimized WebSocket Broadcast

· Integration Zone
Free Resource

Migrating from On-Prem to Cloud Middleware? Here’s what Aberdeen Group says leading companies should be considering. Brought to you in partnershp with Liaison Technologies

Originally authored by David Delabassee

"When you have to make a choice and don't make it, that is in itself a choice."  ( William James)   Tyrus logo

The Java API for WebSocket (JSR 356) is one of the APIs recently added to Java EE 7. It is a '1.0' release, which means that the API is complete and fully functional. It is often said that premature optimization is the root of all evil, so an initial implementation can easily be optimized. The same is also true for features.  Choices had to be made since it is impossible to implement all the desired features in an initial release. Clearly, there are different aspects that could easily be improved going forward.

Tyrus serves as the JSR 356 Reference Implementation.  It is also a test-bed for potential new WebSocket features and improvements. As always, a proprietary feature of an implementation doesn't necessarily means that this particular feature will be included in a future revision of the specification. It could just remain a proprietary feature or an implementation-specific optimization.

In this post, Pavel Bucek, a Tyrus team member, discusses how a WebSocket Server Endpoint could be improved when it needs to broadcast a message to its connected remote endpoints. In Tyrus 1.3, a new broadcast() method has been introduced.  It allows you to broadcast a message by re-using the same data frame for all the remote endpoints.  By doing that, the overall performance should be improved.

Is iPaaS solving the right problems? Not knowing the fundamental difference between iPaaS and iPaaS+ could cost you down the road. Brought to you in partnership with Liaison Technologies.


Published at DZone with permission of Reza Rahman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}