Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Connection closed before receiving a handshake response #113

Closed
Zalasanjay opened this issue Mar 8, 2018 · 3 comments
Closed

Connection closed before receiving a handshake response #113

Zalasanjay opened this issue Mar 8, 2018 · 3 comments

Comments

@Zalasanjay
Copy link

i'm also facing problem like you @huytran0605
getting this error :
wss://ws.xxxxxxxx.xx:4038/socket.io/?EIO=3&transport=websocket' failed: Connection closed before receiving a handshake response

this is the code of my front-end in .vue file

import io from 'socket.io-client';
  import feathers from 'feathers/client';
  import socketio from 'feathers-socketio/client';

  var socket = io('wss://ws.xxxxxxxx:4038', { transports: ['websocket']})
  var app = feathers();
  app.configure(socketio(socket));
  var message = app.service('vshopdata');
  Vue.use(feathers);

this is the code of my back-end in app.js file

const express = require('@feathersjs/express');
const feathers = require('@feathersjs/feathers');
const socketio = require('@feathersjs/socketio');

const app = express(feathers());
app.configure(configuration(path.join(__dirname, '..')))

app.configure(socketio(4038, {
  wsEngine: 'uws',
  origin: '*.xxxxxx.xx:*'
}));
@daffl
Copy link
Member

daffl commented Mar 8, 2018

Is there a reason you are changing all the default settings? In general, websocket connections should be established using HTTP:

var socket = io('http://<myserveriporname>:4038', { transports: ['websocket']})

@Zalasanjay
Copy link
Author

i have tried var socket = io('http://<myserveriporname>:4038', { transports: ['websocket']})
and it works better then my earlier code..! thank you for that.
at least my error failed: Connection closed before receiving a handshake response is solved

But some time when i start my services then getting this error (also this error renders when service is already running)

entityService.on('updated', updateEntity(app));
                    ^

TypeError: Cannot read property 'on' of undefined
    at Namespace.<anonymous> (/home/software/sanjay/80015/PROJECT/pdm/node_modules/@feathersjs/authentication/lib/socket/handler.js:161:21)
    at emitOne (events.js:121:20)
    at Namespace.emit (events.js:211:7)
    at Namespace.emit (/home/software/sanjay/80015/PROJECT/pdm/node_modules/socket.io/lib/namespace.js:212:10)
    at /home/software/sanjay/80015/PROJECT/pdm/node_modules/socket.io/lib/namespace.js:180:14
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

@daffl
Copy link
Member

daffl commented Mar 9, 2018

It needs a users service (or the entity service you configured for authentication) available.

@daffl daffl closed this as completed Mar 13, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants