I would like to emit special event from client side to server. I created a code like this :
const socket = new WebSocket('ws://localhost:9090');
let set_nickname = message => {
socket.emit ("type-event",message)
}
It throws an error:
Uncaught TypeError: socket.emit is not a function
I couldn't find a solution due to this problem (I'm not sure if emit is even implemented in websocket, I couldn't find a method in a specification, but webstorm suggests that I could use this).