willgillen
6 Dec 2009, 12:41 PM
I have the following environment:
1.) ASP.NET Web Application
2.) Using ExtJS and Ext.Direct .NET server-side stack
I have been able to use much of the Ext.Direct remoting apis to send and receive data, but now my project requires a polling service. I am trying to figure out how to use the Ext.Direct server-side stack to implement the polling provider. Unfortunately, it seems that the Ext.Direct server-side stack always sends back the response with {type:'rpc'}, but I need to be able to have a "callback" each time the PollingProvider returns. According to the docs and the examples, this means I need to use Ext.Direct.on('message') in order to trap the polling return as an "event". Has anyone else out here figured out how to use the Ext.Direct .NET server-side stack and the PollingProvider allong with a "callback event"?
Here is some short example of what I'm trying to accomplish:
//This bit of code sets up the PollingProvider:
myPoller = new Ext.direct.PollingProvider({
type:'polling',
interval:15000, //Every 15 seconds.
url:AJAX.Poll //This is an Ext.Direct "Action" method defined on server-side
});
//This bit of code watches for an Ext.Direct "event" called "pollReturn":
Ext.Direct.on('pollReturn',function(e){
alert(e.name);
});
Now, the problem is that when the component "myPoller" executes the "poll", I can see it execute the method on the server-side by debugging the application. However, the response required for Ext.Direct.on() to work should look something like this in the JSON response:
{"type":"event","name":"message","data":"Successfully polled at: 5:58:27 pm"}
But, unfortunately, the Ext.Direct server-side stack always seems to respond something more like this (notice the type is "rpc" instead of "event"):
{"type":"rpc","tid":82,"action":"AJAX","method":"Poll","result":{"name":"pollReturn","data":[{type:"event",name:"message",data:"Successfully polled at 5:58:27 pm"}]}}
Anyone have any ideas how to achieve this "callback" from the .NET Ext.Direct server-side stack? Even if you have any ideas about how to go about this, please feel free to share your thoughts.
Thanks!
1.) ASP.NET Web Application
2.) Using ExtJS and Ext.Direct .NET server-side stack
I have been able to use much of the Ext.Direct remoting apis to send and receive data, but now my project requires a polling service. I am trying to figure out how to use the Ext.Direct server-side stack to implement the polling provider. Unfortunately, it seems that the Ext.Direct server-side stack always sends back the response with {type:'rpc'}, but I need to be able to have a "callback" each time the PollingProvider returns. According to the docs and the examples, this means I need to use Ext.Direct.on('message') in order to trap the polling return as an "event". Has anyone else out here figured out how to use the Ext.Direct .NET server-side stack and the PollingProvider allong with a "callback event"?
Here is some short example of what I'm trying to accomplish:
//This bit of code sets up the PollingProvider:
myPoller = new Ext.direct.PollingProvider({
type:'polling',
interval:15000, //Every 15 seconds.
url:AJAX.Poll //This is an Ext.Direct "Action" method defined on server-side
});
//This bit of code watches for an Ext.Direct "event" called "pollReturn":
Ext.Direct.on('pollReturn',function(e){
alert(e.name);
});
Now, the problem is that when the component "myPoller" executes the "poll", I can see it execute the method on the server-side by debugging the application. However, the response required for Ext.Direct.on() to work should look something like this in the JSON response:
{"type":"event","name":"message","data":"Successfully polled at: 5:58:27 pm"}
But, unfortunately, the Ext.Direct server-side stack always seems to respond something more like this (notice the type is "rpc" instead of "event"):
{"type":"rpc","tid":82,"action":"AJAX","method":"Poll","result":{"name":"pollReturn","data":[{type:"event",name:"message",data:"Successfully polled at 5:58:27 pm"}]}}
Anyone have any ideas how to achieve this "callback" from the .NET Ext.Direct server-side stack? Even if you have any ideas about how to go about this, please feel free to share your thoughts.
Thanks!