Higgs Boson - Node JS
Node JS implementation of the Boson protocol.
The example below users the server example found in the Scala demo
- Start the Scala server
- Run the example below
var higgs =
var client = "localhost" 12001
for var i = 0; i < 1000; i++
a: 1 v: 12345
1 2 3
Protocol and Deviation from the specs
been the entire contents of a long value are taken and broken into "high" and "low" bits.
- The "high" bits (left most 32 bits of the 64 bits) are discarded
- The "low" bits are then treated as an integer and returned. This means if a long value is
received that cannot fit into 32 bits it won't give what you expect.
- If Longs must be sent to the Node JS client then send it as a string!
- I've considered doing something similar to mongo
but it seems over kill if its not absolutely required. Open to suggestions on how to handle it.
Floats & Doubles
No matter what you try, no matter how much you yell floats are the only supported types
WHEN SENDING, the server can send doubles back and they will be handled as expected.
So on the server, don't expect Node JS to send a double, it'll always send a float.
It is possible for Node JS to send Doubles but to do that you'd have to be able to differentiate
between a float and a double. Not found a sensible way to do that.
Maps & POLOs
A POLO is Boson's way of allowing a statically typed language such as Java/Scala to send
is an "object".
In that hash, the keys are the variable names and the values are what were the values of the
variable when the POLO was serialized.
Arrays & Lists
- Practically the only difference between an array and a list is that arrays are ordered
server and receive whatever response that method returned.