-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
Description
Hi there !
Like it say in the RFC 6455
1. If the status code received from the server is not 101, the
client handles the response per HTTP [RFC2616] procedures. In
particular, the client might perform authentication if it
receives a 401 status code; the server might redirect the client
using a 3xx status code (but clients are not required to follow
them), etc. Otherwise, proceed as follows.
But when i try a redirect status 302.
The websocket throw an Error 'unexpected server response (302)'
// serv.js
var Net = require('net')
var Wss = require('ws').Server
var server = new Net.Server()
server.on('connection',socket=>{
socket.write('HTTP/1.1 302 Found\nLocation: ws://localhost:8080\n\n')
socket.end()
})
server.listen(80)
var wss = new Wss({port:8080})// ws.js
var Ws = require('ws')
var ws = new Ws('ws://localhost') // throw Error: unexpected server response (302)I misunderstand something or this is a divergence of the RFC 6455 ?
blandinw, mpazik, wryk, calebboyd, sky0014 and 29 more