Skip to main content
Version: 2.x.x

Listening

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

type ChatMessageType = {
message: string;
};

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

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