The open and free WebSocket server for all.

Documentation

Last updated: October 10th, 2018

Connect

WebSocket.in is open WebSocket server, which means you do not need to login or register to get started. If you are having difficulty getting started, have a look at the code samples given below. There is no additional plugin or library installation required in your app to use the WebSocket.in server.

Copy the WebSocket server URL below, replace channel_id and room_id with your own unique identifiers for the channel and a room inside it.

wss://connect.websocket.in/YOUR_CHANNEL_ID?room_id=YOUR_ROOM_ID

Example of a valid WebSocket url: wss://connect.websocket.in/hack4mer_in?room_id=1998

Parameters

Channel ID

Take this as a unique identifier for your app, this remains constant throughout our application no matter how many connections and rooms you need.

Choosing a channel_id:

  • A channel_id can be alphanumeric and may contain these special characters: - (hyphen), _ (underscore)
  • Min. characters required for channel_id=2 , Max. characters allowed for channel_id = 20
  • Choose a unique channel id and avoid using common channel ids likes "mychannel", "channelx" etc. Otherwise, your channel connections may conflict with others trying to use the same channel_id

Room ID

Room ID is an optional parameter in the WebSocket url, default room_id = 1, if not provided.

Why room_id? While channel_id should be constant throughout your application, room_id may vary depending upon your requirements. When a message is sent by a user, it is passed to only the members of the sender's room.

For example: Let's say you are using two WebSocket.in endpoints,

  • A: wss://connect.websocket.in/hack4mer_in?room_id=1998
  • B: wss://connect.websocket.in/hack4mer_in?room_id=1999.
Suppose, there are 5 users connected to each room. When a user from room 1998 sends a message, it is recieved by other 4 members of the room 1998 only.

Choosing a room_id:

  • A room_id can be alphanumeric and may contain these special characters: - (hyphen), _ (underscore)
  • Max. characters allowed for room_id = 20
  • Change room_id when you want to isolate a group of users for data transmission.

Code samples

Following code samples demonstrate how to connect to a WebSocket.in server

Javascript
var socket = new WebSocket("wss://connect.websocket.in/YOUR_CHANNEL_ID?room_id=YOUR_ROOM_ID");
Android/Java
private void start() {
    Request request = new Request.Builder().url("wss://connect.websocket.in/YOUR_CHANNEL_ID?room_id=YOUR_ROOM_ID").build();
    EchoWebSocketListener listener = new EchoWebSocketListener();
    WebSocket ws = client.newWebSocket(request, listener);
    client.dispatcher().executorService().shutdown();
}
Reference: https://medium.com/@ssaurel/learn-to-use-websockets-on-android-with-okhttp-ba5f00aea988
iOS/Swift
var socket = WebSocket(url: URL(string: "wss://connect.websocket.in/YOUR_CHANNEL_ID?room_id=YOUR_ROOM_ID")!, protocols: ["chat"])
Reference: https://www.raywenderlich.com/861-websockets-on-ios-with-starscream

Frequently Asked Questions

is WebSocket.in free?

Yes

How many channels can I use?

Currently, we have not placed any limits on the number of channels a person can use. However, we recommend you to use one channel per application.

How many rooms can a channel have?

Unlimited, for now. As WebSocket.in becomes popular we might be required to place some limits on the number of rooms a channel can have due to resource usage and associated costs.

Can anyone connect to my channel?

Yes, anyone can connect to any channel and a room inside it. That's why we recommend using a unique channel_id. This might be possible in near future, for a user to have control on a channel and reserve its access rights.

will WebSocket.in will always be free?

Yes! Resource usage and associated costs might force us to launch paid plans in the future when the product matures. However, there will always be a free plan with enough features for you to run your application.