-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Cettia transport can carry binary data but how to make use of it for socket has not been yet determined. With this feature, you will be able to exchange events whose data is binary without binary-to-text conversion.
There are two ways to implement the feature:
- Introduce our own event object format.
It defines how each byte or character should be transferred to describe an event. - Describe event object by reusing existing data format for binary.
It requires a binary interchange format.
Here's the Event interface described in WebIDL:
[Constructor]
interface Event {
readonly attribute string id;
readonly attribute string type;
readonly attribute any data;
readonly attribute boolean reply;
};I'm inclined to choose 2nd option. Because, brand new protocol would be a barrier to implement it in other languages comparing to use existing other text interchange format and binary interchange format with some restrictions, and also that data format can be a replaceable building block, where it allows for user to replace with other one on demand. BTW, it's possible to implement 1st option by redefining that building block of 2nd option.
The binary data format should meet the followings like JSON:
- It should be able to describe
any(schema-less) type value. - It should be widely adopted and available in browser and Java.
Apart from implementation, two separate methods to determine whether to send a given arbitrary event as a text message or binary message, repsectively, are probably required. Also, there should be a guide for behavior of the default send method. If that guide is perfect, we may not need to provide separate methods.
To do:
- Find the default data format for binary.
- Think out the default behavior of send method.
Name two separate methods for this feature if the default behavior is not well defined.