RE: [Catalyst] Pushing data to Catalyst powered web page
Hi all I did the following to get data to push to the web page: Scenario: An RFID tag is read and processed by an ALE server. The ALE server then sends the data to my Catalyst URL: http://x.x.x.x:3000/ale/notifier?tagdata The ale/notifier action then extracts the tag id from the variable and then does a lookup in a database to get the data associated to the tag. It then puts the tag data in a queue and the last action is to make a socket connection, as a client, to a socket server running inside the /assettracker/display_tagdata action. The following code is an extract from the ale/notifier: sub notify_tag_read { use IO::Socket::INET; my $MySocket=new IO::Socket::INET->new(PeerPort=>26482,Proto=>'udp',PeerAddr=>'x.x.x.x'); my $msg = ""; $MySocket->send($msg); } When I access, via a browser, the url http://x.x.x.x:3000/assettracker/display_tagdata it loads a socket server and waits for a connection from a client. The following is a snippet of the /assettracker/display_tagdata action: sub display_tagdata : Local { my ( $self, $c ) = @_; my $text; my @args; $c->stash->{template} = 'sockettest.tt2'; use IO::Socket::INET; my $MySocket=new IO::Socket::INET->new(LocalPort=>26482,Proto=>'udp',Reuse=>1); $MySocket->recv($text,128); @args = [$text]; $c->forward('get_tagdata',[EMAIL PROTECTED]); } This action will then forward to /assettracker/get_data to retrieve the data from the queue and display it in the browser. I know that the code is not great, but it works. Thank you for all the assistance that I received. Regards Morne -Original Message- From: Bill Moseley [mailto:[EMAIL PROTECTED] Sent: 12 September 2008 09:46 PM To: The elegant MVC web framework Subject: Re: [Catalyst] Pushing data to Catalyst powered web page On Fri, Sep 12, 2008 at 02:15:23PM +0200, Supra, Morne wrote: > > The problem that I have is that I have no idea how to push the data to a > web page instead of pulling. Pull with an AJAX update, perhaps. -- Bill Moseley [EMAIL PROTECTED] Sent from my iMutt ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser: https://www.fnb.co.za/disclaimer.html If you are unable to access the Disclaimer, send a blank e-mail to [EMAIL PROTECTED] and we will send you a copy of the Disclaimer. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] Pushing data to Catalyst powered web page
Morning to everybody that has assisted so far. I have not been able to resolve the problem yet, most likely because I did not explain my issue correctly. I think that I require some kind of publish and subscribe solution for this. I really want to use Catalyst as far as possible, as it has really been useful in other projects. I need my "view tag data" page to subscribe to a publisher. When the publisher receives new tag data it should push it to the subscriber so the subscriber can then show it on its page automagically. Regards Morne -Original Message- From: cranky [mailto:[EMAIL PROTECTED] Sent: 12 September 2008 02:41 PM To: catalyst@lists.scsys.co.uk Subject: Re: [Catalyst] Pushing data to Catalyst powered web page Supra, Morne wrote: > > > sub notifier : Private { > my ( $self, $c ) = @_; > > #$c->stash->{template} = 'notifier.tt2'; > $c->stash->{tagdata} = $c->request->params->{tagdata}; > open (TagData, '>C:\Eclipse Projects\Asset > Tracker\AssetTracker\lib\AssetTracker\tagdata.txt'); > print TagData $c->request->params->{tagdata}; > close TagData; > > } > > As you can see I do not get the associated tag data yet, I am just > trying to display the tag data received from the ALE server. > > I can see that the data is coming through correctly by monitoring the > console debug and checking the tagdata.txt file. > > The problem that I have is that I have no idea how to push the data to a > web page instead of pulling. > > I have tried using catalyst redirect, forward and subrequest with no > luck. > > I am not a hard core developer, so any assistance will be greatly > appreciated. > > Regards > Morne Supra > > If you want an upload of your data (i.e., tagdata.txt) to a web page, then I think its nothing to do with catalyst. Use the LWP module where you can POST file to a web page. This link might help-> http://lwp.interglacial.com/ch05_07.htm -- View this message in context: http://www.nabble.com/Pushing-data-to-Catalyst-powered-web-page-tp194547 67p19454995.html Sent from the Catalyst Web Framework mailing list archive at Nabble.com. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser: https://www.fnb.co.za/disclaimer.html If you are unable to access the Disclaimer, send a blank e-mail to [EMAIL PROTECTED] and we will send you a copy of the Disclaimer. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Pushing data to Catalyst powered web page
Bill Moseley <[EMAIL PROTECTED]> wrote on 09/12/2008 02:45:42 PM: > On Fri, Sep 12, 2008 at 02:15:23PM +0200, Supra, Morne wrote: > > > > The problem that I have is that I have no idea how to push the data to a > > web page instead of pulling. > > Pull with an AJAX update, perhaps. > Or, if you control both the app that reads the RFID and the webapp that is to display them, why not have the RFID app insert into the webapps db directly instead of some url post? -Wade ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Pushing data to Catalyst powered web page
On Fri, Sep 12, 2008 at 02:15:23PM +0200, Supra, Morne wrote: > > The problem that I have is that I have no idea how to push the data to a > web page instead of pulling. Pull with an AJAX update, perhaps. -- Bill Moseley [EMAIL PROTECTED] Sent from my iMutt ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Pushing data to Catalyst powered web page
Good afternoon all I am busy with a project where I need to read an RFID tag, get the data associated with the tag and then push the data to a web page for a security person to monitor. I can successfully read the tag by using LogicAlloy's ALE server. It then calls my Catalyst application at http://localhost/ale/notifier : sub notifier : Private { my ( $self, $c ) = @_; #$c->stash->{template} = 'notifier.tt2'; $c->stash->{tagdata} = $c->request->params->{tagdata}; open (TagData, '>C:\Eclipse Projects\Asset Tracker\AssetTracker\lib\AssetTracker\tagdata.txt'); print TagData $c->request->params->{tagdata}; close TagData; } As you can see I do not get the associated tag data yet, I am just trying to display the tag data received from the ALE server. I can see that the data is coming through correctly by monitoring the console debug and checking the tagdata.txt file. The problem that I have is that I have no idea how to push the data to a web page instead of pulling. Hi, you might want to have a look at http://meteorserver.org/. This server pushes data to a client via a persistent http connection. To handle such things with catalyst is not a very good idea. the ALE server will talk to the meteor server and not the catalyst application. If you do not need realtime push you could reload a catalyst page every x seconds. This page opens the file tagdata.txt and prints its content. Add a html meta tag to reload the page every x seconds. moritz ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Pushing data to Catalyst powered web page
Supra, Morne wrote: > > > sub notifier : Private { > my ( $self, $c ) = @_; > > #$c->stash->{template} = 'notifier.tt2'; > $c->stash->{tagdata} = $c->request->params->{tagdata}; > open (TagData, '>C:\Eclipse Projects\Asset > Tracker\AssetTracker\lib\AssetTracker\tagdata.txt'); > print TagData $c->request->params->{tagdata}; > close TagData; > > } > > As you can see I do not get the associated tag data yet, I am just > trying to display the tag data received from the ALE server. > > I can see that the data is coming through correctly by monitoring the > console debug and checking the tagdata.txt file. > > The problem that I have is that I have no idea how to push the data to a > web page instead of pulling. > > I have tried using catalyst redirect, forward and subrequest with no > luck. > > I am not a hard core developer, so any assistance will be greatly > appreciated. > > Regards > Morne Supra > > If you want an upload of your data (i.e., tagdata.txt) to a web page, then I think its nothing to do with catalyst. Use the LWP module where you can POST file to a web page. This link might help-> http://lwp.interglacial.com/ch05_07.htm -- View this message in context: http://www.nabble.com/Pushing-data-to-Catalyst-powered-web-page-tp19454767p19454995.html Sent from the Catalyst Web Framework mailing list archive at Nabble.com. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Pushing data to Catalyst powered web page
Good afternoon all I am busy with a project where I need to read an RFID tag, get the data associated with the tag and then push the data to a web page for a security person to monitor. I can successfully read the tag by using LogicAlloy's ALE server. It then calls my Catalyst application at http://localhost/ale/notifier : sub notifier : Private { my ( $self, $c ) = @_; #$c->stash->{template} = 'notifier.tt2'; $c->stash->{tagdata} = $c->request->params->{tagdata}; open (TagData, '>C:\Eclipse Projects\Asset Tracker\AssetTracker\lib\AssetTracker\tagdata.txt'); print TagData $c->request->params->{tagdata}; close TagData; } As you can see I do not get the associated tag data yet, I am just trying to display the tag data received from the ALE server. I can see that the data is coming through correctly by monitoring the console debug and checking the tagdata.txt file. The problem that I have is that I have no idea how to push the data to a web page instead of pulling. I have tried using catalyst redirect, forward and subrequest with no luck. I am not a hard core developer, so any assistance will be greatly appreciated. Regards Morne Supra To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser: https://www.fnb.co.za/disclaimer.html If you are unable to access the Disclaimer, send a blank e-mail to [EMAIL PROTECTED] and we will send you a copy of the Disclaimer. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/