We can use JavaScript client exchange data as follows:
socket.onchannelmessage = (channelMessage) => {
console.info(“Received chat message:”, channelMessage);
};
const channelId = “pineapple-pizza-lovers-room”;
var response = await socket.send({ channel_join: {
type: 1, // 1 = room, 2 = Direct Message, 3 = Group
target: channelId,
persistence: false,
hidden: false
} });
console.info(“Successfully joined channel:”, response.channel.id);
const messageAck = await socket.send({ channel_message_send: {
channel_id: response.channel.id,
content: {“message”: “Pineapple doesn’t belong on a pizza!”}
} });
console.info(“Successfully sent chat message:”, messageAck);
How to send data in real time in Java class library like this.