...

/

Authenticating Communication

Authenticating Communication

Let’s have a look at how to use WebSockets to enable authentication in our application.

We'll cover the following...

Handling authentication with WebSockets can be tricky, WebSockets are used alongside regular HTTP requests in many applications. The authentication will usually be done via regular REST or OAUTH calls. The front end will grant a token either set in cookies or saved in localStorage.

A special agreed-upon action has to be sent by the client to allow the server to authenticate a WebSocket. In Redux, a special action object can be serialized and sent before doing any other work over WebSockets.

Sample flow

A simple way to implement authentication might be to ...