Skip to content

Instantly share code, notes, and snippets.

@zedtux
Created June 17, 2019 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zedtux/0932fd1dac3c77ad074b02754b05ecef to your computer and use it in GitHub Desktop.
Save zedtux/0932fd1dac3c77ad074b02754b05ecef to your computer and use it in GitHub Desktop.
Tester rapidement une WebSocket (Utilisé dans l'article https://blog.zedroot.org/2019/06/17/tester-rapidement-la-connexion-a-une-websocket/)
let ws = new WebSocket('wss://ws.domain.eu/cable/', ['actioncable-v1-json']);
ws.onopen = () => { console.log('WS Open') };
ws.onerror = (error) => { console.log('WS ERROR:', error) };
ws.onclose = () => { console.log('WS CLOSED') };
ws.onmessage = (message) => { console.log('WS message:', message) };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment