I'm working on a simple web app that uses JWT authentication. Only authenticated users may open a Websocket with the server, and as it turns out, this is more complicated than setting an Authentication header (HTTP headers in Websockets client API).
I'm following this article https://devcenter.heroku.com/articles/websocket-security#authentication-authorization to work around this. The above article describes generating a ticket for an authenticated client upon request (the ticket contains user id + IP address), storing the ticket (which expires after X seconds), and then having the client open a Websocket with the ticket as part of the URL. (e.g. "ws://localhost:3000/conn/[myticket]" or "ws://localhost:3000/conn?ticket=[myticket]").
Here's my question: should this ticket be encrypted? If the ticket wasn't encrypted, could somebody spoof an IP address and then forge a valid ticket from that address, knowing that the ticket is unexpired and unused?
Follow-up question: how should this ticket be encrypted? It has to be sent as part of a URL, so is binary encryption possible, or does it have to be UTF-8?