5.2.6 – Extend Gateway: Gateway Channel
You can create multiple gateway channels to create a communication layer between client browser and the gateway:
var gvc = new r.GatewayChannel();
gvc.name = "gwc";
gvc.process = function(buffer){
console.log(buffer.getByte());
console.log(buffer.getLittleEndian16());
};
gvc.onopen = function(){
var data = new Array(7);
var rb = new RdpBuffer(data, 0, 7);
rb.setByte(3);
rb.setLittleEndian16(45);
rb.setLittleEndian32(678);
rb.markEnd();
gvc.send(rb);
};
r.addGatewayChannel(gvc);
On gateway side, you class must extend com.toremote.gateway.plugin.AbstractGatewayChannel and register it with the same name using HandlerManager.registerChannel(). Please check the plugin example for more information.