Where I'm wrong ? I try to intercept the Event from Native object, but this
don't fire on message arrives.
var ws = new test.WebSocket();
qx.bom.Event.addNativeListener(ws,"message", function(e) {
alert("connessione aperta");
}, false);
/**
* @ignore(WebSocket)
*/
qx.Class.define("test.WebSocket",
{
extend : qx.core.Object,
construct : function()
{
this.base(arguments);
this.socket = new WebSocket('ws://127.0.0.1:3500/');
// register native event-listeners
this.socket.addEventListener("open", this.onSocketOpen , false);
this.socket.addEventListener("message", this.onSocketMessage , false);
this.socket.addEventListener("close", this.onSocketClose , false);
this.socket.addEventListener("error", this.onSocketError , false);
},
events :
{
"reload" : "qx.event.type.Event",
"post" : "qx.event.type.Data"
},
members :
{
// holding the native WebSocket
socket : null,
// event-handlers
onSocketOpen : function(e) {
console.log("Connection opened");
},
onSocketMessage : function(e) {
console.log("Message received: " + e.data);
alert(e.data);
},
onSocketClose : function(e) {
console.log("Connection closed");
},
onSocketError : function(e) {
console.log("An error occured!");
},
send : function(message)
{
this.socket.send(message);
}
}
});
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/how-to-use-or-integrate-socket-in-qooxdoo-tp7584526p7584588.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel