Websocket Client

Subscribing to the channels Channel and OnWalletChange.

The player JWT token should be provided through the query parameter access_token.

<script src="https://cloud.socino.com/messages-staging/js/signalr/dist/browser/signalr.js"></script>
<script>
    var connection = new signalR.HubConnectionBuilder().withUrl("https://cloud.socino.com/messages-staging/messageHub?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxYWYxMWEyYzFkZGNmNGZkOTQ0YTQwMSIsImVtYWlsIjoibmlja0Bzb2Npbm8uY29tIiwidXNlcm5hbWUiOiJuaWNrLnBlZGVyc2VuIiwiaWF0IjoxNjc0MjAxMTY4LCJleHAiOjE2NzQzNzM5Njh9.UlHKasp27E_g_ocHsmuW_tLbbnXA3i6ocln2YFuSJDU").withAutomaticReconnect().build();

    connection.on("Channel", function (jsonMessage) {
        console.log(jsonMessage);
    });

		connection.on("OnWalletChange", function(jsonMessage){
    		console.log(jsonMessage);
    });

    connection.start().then(function () {}).catch(function (err) {
        return console.error(err.toString());
    });
</script>

When the client has connected, the client will automatically be assigned to the channel/group that is their playerId. Meaning you can use the playerId as the channel in the SendToChannel request.