Comments (8)
Great question
from websocket.io.
BTW: I just figure it out origin header has no use at all
http://learnitcorrect.com/blog/websocket-is-great-but-not-the-origin-policy.html
from websocket.io.
It does have an use, see the comment by @saurik. Of course anyone can create a new request with any Origin
whatsoever from their terminal, but the key is can the website the user is visiting do it ?
from websocket.io.
Yes. he is correct.
So how about a API like this?
var options = {
allowOrigin: function(origin) {
return true;
}
};
var ws = require('websocket.io')
, server = ws.listen(3000, null, options);
server.on('connection', function (socket) {
socket.on('message', function () { });
socket.on('close', function () { });
});
from websocket.io.
Async maybe ?
And called originCheck
?
from websocket.io.
Sounds good to me.
And this should be optional right?
var options = {
originCheck: function(origin, confirm) {
confirm(true);
}
};
var ws = require('websocket.io')
, server = ws.listen(3000, null, options);
server.on('connection', function (socket) {
socket.on('message', function () { });
socket.on('close', function () { });
});
from websocket.io.
Correct.
If falsy, accepts the origin.
If function, supplies the origin and callback.
from websocket.io.
awesome.
from websocket.io.
Related Issues (20)
- Deprecate #open, use #readyState HOT 1
- server.clients grows over time HOT 2
- Method writeUInt16BE missing in Node 0.4 HOT 1
- Leverage ws parsers HOT 6
- Replace logger by debug?
- Server reference in Socket
- Error handling must be reworked HOT 8
- separate servers for sub-protocols (i.e. Sec-WebSocket-Protocol) HOT 1
- client tracking bug in handleUpgrade HOT 14
- inconsistency between ws.WebSocket.readyState and websocket.io/hybi/WebSocket.readyState HOT 1
- Sub-protocol support broken
- Mask Send Messages
- WSS enable ? HOT 2
- IP Adress HOT 2
- Empty/Undefined error-Events
- Warning in Node 6.1.0 HOT 1
- (node:6620) DeprecationWarning: process.EventEmitter is deprecated. use require('events') instead. HOT 5
- Parser.prototype.__proto__ = EventEmitter.prototype; TypeError: Cannot read property 'prototype' of undefined HOT 4
- Uses vulnerable version of ws
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websocket.io.