This repository contains a barebones WebSocket server and client implementation written in 100% Java. The underlying classes are implemented java.nio, which allows for a non-blocking event-driven model (similar to the WebSocket API for web browsers). The org.java_websocket.server.WebSocketServer abstract class implements the server-side of the WebSocket Protocol. A WebSocket server by itself doesn't do anything except establish socket connections though HTTP. After that it's up to your subclass to add purpose. The org.java_websocket.client.WebSocketClient abstract class can connect to valid WebSocket servers. The constructor expects a valid ws:// or wss:// URI to connect to. Important events onOpen, onClose, onMessage and onError get fired throughout the life of the WebSocketClient, and must be implemented in your subclass.

Features

  • The WebSocketServer detects any draft of a connecting client by default
  • The WebSocketClient on the other hand is the one who initiates the connection and therefore has to decide which draft to use
  • Draft is the base class for everything of a websocket specification which is not common such as the way the handshake is read or frames are transfered
  • The WebSocket protocol has been evolving since 2009
  • Using Java-Websocket is very similar to using javascript websockets
  • You simply take the client or the server class and override its abstract methods by putting your application logic in place

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow Java WebSockets

Java WebSockets Web Site

Other Useful Business Software
Turn Your Content into Interactive Magic - For Free Icon
Turn Your Content into Interactive Magic - For Free

From Canva to Slides, Desmos to YouTube, Lumio works with the tech tools you are already using.

Transform anything you share into an engaging digital experience - for free. Instantly convert your PDFs, slides, and files into dynamic, interactive sessions with built-in collaboration tools, activities, and real-time assessment. From teaching to training to team building, make every presentation unforgettable. Used by millions for education, business, and professional development.
Start Free Forever
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Java WebSockets!

Additional Project Details

Operating Systems

Android

Programming Language

Java

Related Categories

Java WebSocket Servers

Registered

2021-07-12