adonisjs / adonis-websocket-client

Websocket client for AdonisJs framework.
52 stars 48 forks source link

Websocket Babel Error Fix #58

Closed waxapi closed 5 years ago

waxapi commented 5 years ago

This is the fix to the problem I see a lot of you are having with the WebSocket client and is not included in the docs. Just npm install and import babel-polyfill.


import Ws from '@adonisjs/websocket-client'

import Vue from 'vue'

// production change ws:// to wss:// for security
var ws = Ws('ws://localhost:3333')

ws.connect()

ws.on('open', () => {
      alert('Connected to server.')
})