Tags: baijum/webtail
Tags
Receive messages through websocket and display - Client side HTML & JavaScript to receive a `hello` message - In the client JavaScript, WebSocket connection object is created and an event handler is registered for `onmessage` event. The handler fuction write the message to the console (To see the message, open the console in debug window). - In the server, HTTP handler write a `hello` message to websocket. Normal HTTP request is upgraded to websocket using the Gorilla websocket package. - URL origin check is disabled. This is required as the HTML is not served from the same URL origin. This can be changed later.
PreviousNext