Websocket connection refused

#1

Hi everyone,

I’m working on a project with adonis in the backend and Vue.js in Frontend.
But when I start use websocket, I don’t can resolve this problem: when try connect, the console show this error

This is my Vue.js component code:

import "babel-polyfill"
import Ws from '@adonisjs/websocket-client'


export default {

        mounted() {
            const ws = Ws('ws://127.0.0.1:3333')
            ws.connect()
        },
}

Can anyone help me with this problem?

0 Likes

#2

Sorry, I could already correct solve. I skipped a step of installation:

const { Ignitor } = require('@adonisjs/ignitor')

new Ignitor(require('@adonisjs/fold'))
   .appRoot(__dirname)
   .wsServer() // boot the WebSocket server
   .fireHttpServer()
   .catch(console.error)

Excuse me

1 Like