Skip to content

Instantly share code, notes, and snippets.

@littlepsylo
Last active July 28, 2016 13:37
Show Gist options
  • Save littlepsylo/341ed91aed9870924de082d9d1eee580 to your computer and use it in GitHub Desktop.
Save littlepsylo/341ed91aed9870924de082d9d1eee580 to your computer and use it in GitHub Desktop.
Using WebSocket in react-native with a socket.io server
const io = new WebSocket('ws://yourdomain:port/socket.io/?transport=websocket')
io.onclose = e => console.log('onclose', e.code, e.reason)
io.onerror = e => console.log('onerror', e.message)
io.onopen = () => console.log('connected !')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment