sono.land
message
message
Send message to all
Message, sends the message to all clients including the sender. Upon invoking message the first argument being the message is required however there is an optional second argument a custom event name. This custom event name will be stored in the response the server sends to all applicable clients. This will allow developers to create custom events dependent on the custom event name they are receiving on the client side from the server.
1// example below sends a message to members of a channel2document.getElementById('send').addEventListener('click', () => {3 const message = document.getELementbyId('message').value;4 sono.message(message);5});