Comments (7)
Interesting related thread on ws binary safety: protobufjs/protobuf.js#176
current status hints: http://autobahn.ws/testsuite/reports/clients/index.html
from jsmq.
OK, I think we should support binary messages.
Few thoughts:
- Part of the handshake the client should tell the server if we want to speak base64 or binary.
- Anyway the JSMQ library will receive and send ByteBuffer (from https://github.com/dcodeIO/ByteBuffer.js), Uint8Array or ArrayBuffer?
from jsmq.
Also we need to change ZWS
from jsmq.
I think we should consider this a peer-to-peer protocol where either side may request a certain feature; this will cover client/server but not exclude other scenarios. 'text only' would be such a feature.
I see two ways to go about it - either do an in-band handshake at connect time, or use the Websocket protocol name to have the Websocket upgrade phase negotiate a frame encoding. Using the latter means we would need variants of the protocol name (eg 'ZWS-base64-1.0' or 'ZWS1.0', the latter suggesting binary mode). But it would take care of negotiating the right setting already before connection established, and not require another protocol handshake which needs to be specified, implemented and maintained. And it would be extensible, for instance if one did a more efficient base128 encoding, that just can be offered during connect but it wont affect the peer side if not implemented.
How do you feel about protocol names with an embedded encoding type? I think it'd be the easiest route, and that handshake was intended to do exactly that.
That would suggest we specifiy the protocol per se as if links were always binary-safe, and have the protocol variant take care of encoding.
That opens the road to using normal binary ints to tag frames (actually I would use varints like in protobuf, because they would be single byte in the common case but have the option up to say 2^32-1 frame tags if needed).
Once the frame is constructed and if a text encoding is requested, the whole frame including headers is encoded (say base64 for now).
I would think this takes care of your firewall and browser version concerns?
JSMQ library: I dont an educated opinion here yet but will look into it. I would think the protocol should be specified in abstract terms as to how the frame format and field encoding works; if a specific JS construct does the job that would be fine as implementation vehicle.
from jsmq.
I'm not JS expert either.
regarding you suggestion with protocol name, I agree, it is the simplest.
I will update the ZWS document today.
from jsmq.
excellent. So I understand we have agreement on having the protocol per se specified in binary, and let the selected protocol name choose the method for wrapping each frame if needed.
On the tag encoding: I'll make that a separate issue since different theme.
from jsmq.
taking cues from MQTT: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.javascript.git/tree/src/mqttws31.js - this uses arraybuffer and assumes the link is clean
from jsmq.
Related Issues (7)
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 jsmq.