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
});