Is there is any example code with headauth and Websocket? I am using WebSocket with header Authorization set, but donot see headauth getting called.
Hi, and welcome to the forum!
headerauth is only used by HTTP requests at the moment. Not WebSocket. It will likely change in the future (when support for setting cookies is implemented), but for now you can call it manually from the ResClient.setOnConnect callback:
let client = new ResClient("ws://127.0.0.1:8080"); client.setOnConnect(c => client .authenticate('auth', 'jwtHeader') // same as headerauth "auth.jwtHeader" .catch(err => console.log("Failed to log with headers")); );
It will behave similar, but will be sent after the connection is established, prior to any other request, allowing you to check if the call went well or not.
Hope that helps.