Connecting to Neoroute with WebSocket

No matter what client SDK you use, this guide will teach you how to connect to your server using a WebSocket transporter.

Hint: You can make your life a lot easier by using code generation. Just pointing it out, this guide will basically be equivalent.

Creating the client

Before opening the actual connection, you need to create a client (this is the object you’ll be using to send requests).

This is an abstraction we put over the actual connection since you could also be connecting to the server in a different way. The actual message you send is the same between WebSocket and HTTP.

Connecting to the server

Since WebSocket has persistent connections, you need to actually connect to the server using the Connect function (or whatever it is called in your SDK, look below).

Closing the connection

If you want to close the connection you established, you can use the Close function (or equivalent).

From now

Depending on what SDK you use, you can now send requests to your server or receive events from your server over the WebSocket connection. Click on any of the links to learn more about those capabilities.