public void sendDataPacket(String cmd, String nodeID, Context ctx, byte[] bytes, long sequence) {
		FastBuildTree msg = new FastBuildTree(7);

		// Add required properties (version, sender's nodeID, request ID)
		msg.putUnsafe("ver", PROTOCOL_VERSION);
		msg.putUnsafe("sender", this.nodeID);
		msg.putUnsafe("id", ctx.id);

		// Streaming in progress
		msg.putUnsafe("stream", true);

		// Stream packet counter (1...N)
		msg.putUnsafe("seq", sequence);

		// Add "params" block
		FastBuildTree params = new FastBuildTree(2);
		if (PACKET_RESPONSE.equals(cmd)) {
			msg.putUnsafe("success", true);
			msg.putUnsafe("data", params);
		} else {
			msg.putUnsafe("params", params);
		}
		params.putUnsafe("type", "Buffer");

		// Convert signed byte array to unsigned short array
		if (usingJsonSerializer) {

			// Using NodeJS compatible byte-array encoding
			short[] data = new short[bytes.length];
			for (int i = 0; i < bytes.length; i++) {
				data[i] = (short) (bytes[i] & 0xFF);
			}
			params.putUnsafe("data", data);
		} else {

			// Other formats, eg. MessagePack
			params.putUnsafe("data", bytes);
		}

		// Send message
		publish(cmd, nodeID, msg);
	}
public void sendDataPacket ( String cmd , String nodeID , Context ctx , byte [ ] bytes , long sequence ) { FastBuildTree msg = new FastBuildTree ( 7 ) ; msg . putUnsafe ( "ver" , PROTOCOL_VERSION ) ; msg . putUnsafe ( "sender" , this . nodeID ) ; msg . putUnsafe ( "id" , ctx . id ) ; msg . putUnsafe ( "stream" , true ) ; msg . putUnsafe ( "seq" , sequence ) ; FastBuildTree params = new FastBuildTree ( 2 ) ; if ( PACKET_RESPONSE . equals ( cmd ) ) { msg . putUnsafe ( "success" , true ) ; msg . putUnsafe ( "data" , params ) ; } else { msg . putUnsafe ( "params" , params ) ; } params . putUnsafe ( "type" , "Buffer" ) ; if ( usingJsonSerializer ) { short [ ] data = new short [ bytes . length ] ; for ( int i = 0 ; i < bytes . length ; i ++ ) { data [ i ] = ( short ) ( bytes [ i ] & 0xFF ) ; } params . putUnsafe ( "data" , data ) ; } else { params . putUnsafe ( "data" , bytes ) ; } publish ( cmd , nodeID , msg ) ; }
--- DATA PACKET (STREAMING) ---