How can I autheticate users for socket io communication?

Viewed 19

app.use('/user',authentication.authenticateToken,userRoutes) this is how my https request works. first it goes to the middleware named authentication.authenticateToken and once access token is verified it calls next() and gose to the useRoutes and completes the desired job. Now I want to do the same thing for socket.io requets How can I authenticate users when he sends message and how can I use the middleware ?

1 Answers

I think answer of your this question in this link , In this link, I cteated a simple middelware in socket.io.

Click

Related