The open and free WebSocket server for all.

Documentation

V2, Latest stable

Connect

WebSocket.in is open WebSocket server, anyone can create an account and generate an access token to start using the server. 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 token with your own numeric identifier for the channel and an access token.

wss://connect.websocket.in/v2/YOUR_CHANNEL_ID?token=YOUR_ACCESS_TOKEN

Example of a valid WebSocket url: wss://connect.websocket.in/v2/1?token=token_here

Parameters

Token

You can generate access tokens from your Websocket.in account for free

  • You can generate multiple access tokens for multiple projects
  • Access tokens are free and we do not offer paid plans at the moment
  • Not required, but you shoud hide your token while using it on the client-side (Javascript).

Channel ID

It should be a positive integer between 1-10000.

When a message is sent by a user, it is passed to only the members of the sender's channel.

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

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

Choosing a channel:

  • A channel_id can be any number between 1-10000
  • Change channel_id when you want to isolate a group of users for data transmission.
  • Sender of a message will not receive their own message.

Code samples

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

Javascript
var socket = new WebSocket("wss://connect.websocket.in/v2/YOUR_CHANNEL_ID?token=YOUR_ACCESS_TOKEN");
Android/Java
private void start() {
    Request request = new Request.Builder().url("wss://connect.websocket.in/v2/YOUR_CHANNEL_ID?token=YOUR_ACCESS_TOKEN").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/v2/YOUR_CHANNEL_ID?token=YOUR_ACCESS_TOKEN")!, protocols: ["chat"])
Reference: https://www.raywenderlich.com/861-websockets-on-ios-with-starscream

Frequently Asked Questions

is WebSocket.in free?

Yes

How many access tokens can I use?

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

Can anyone connect to my channel?

Yes, if they have your access token.

I'm having troubles with the Websocket

You can test your websocket connection issues with the Online websocket tester. The tool helps you to send and receive data through the Websocket connection.

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.

Changelog & Upcoming

Changelog:

  • Add user account features
  • Secure channels with API keys
    Upcoming features:

    • Hide api keys on client-side with origin host validation
    • Serverless socket.io channels
    • More sample codes
    • Tweet to @hack4mer to request more features
      ;