In the previous tutorials we used websocket headers to pass authentication token and ClientProperties. While native apps can use this method, browsers do not have standard API to control the websocket headers. Thus the API has another mechanism to pass this information.

The websocket initation request will be sent without any headers:

wscat -k 60 -c "wss://$LP_ASYNCMESSAGINGENT/ws_api/account/$LP_ACCOUNT/messaging/consumer?v=3"

After the websocket is opened you will have a few seconds to send the InitConnection request, including your JWT (copy it from the output of echo $LP_JWT command).

{"kind":"req","id":"0","type":"InitConnection","headers":[{"type":".ams.headers.ClientProperties","deviceFamily":"MOBILE","os":"ANDROID"},{"type":".ams.headers.ConsumerAuthentication","jwt":"__YOUR_JWT__"}]}

Note: You can use the message builder () to build the above message.

From that point the protocol can continue in the same way.