Skip to main content
Version: 5.x.x

Listening

Use the listen method to start the listening for incoming events.

type ChatMessageType = {
message: string;
};

const onChatMessage = socketInstance.createListener<ChatMessageType>()({
endpoint: "chat-message", // endpoint of the event
});

onChatMessage.listen((message) => {
console.log(message); // ChatMessageType
});