Server Push - HowTo?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Server Push - HowTo?

tacrom

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

smaldini
How that Events Push doesn't work out of the box ?


On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)




--
Stéphane
--

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

Eamonn O'Connell-2
In reply to this post by tacrom
Hey Heniz, 

Is server push Server -> Client, or Client -> Server ?

Eamonn


On 14 February 2013 09:37, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)


Reply | Threaded
Open this post in threaded view
|

RE: Server Push - HowTo?

tacrom
In reply to this post by smaldini

Hello Stephane,

I set up the project from scratch, added  ‘:platform-core:1.0.M6’ and ‘:events-push:1.0.M3’ plugins

and added the ‘savedTodo’ event to my “PushEvents.groovy” file, residing in ‘grails-app/conf’ directory.

Like:

<code>

events = {

  ‘savedTodo’ browser: true

}

</code>

 

After that I created my Service class as ‘PushService.groovy’ and defined the ‘savedTodo’ method like:

<code>

import grails.events.Listener

 

class PushService {

  @Listener(namespace = ‘browser’)

  def savedTodo(Map data) {

    println(data)

    data.moreData = ‘There we go’

    event.(‘savedTodo’, data, {})

}

}

</code>

 

And even if I tried several attempts of invoking the push functionality from the browser via JavaScript,

I see that the ‘savedTodo’ method is never touched, so I see no output on the console, I get no debugging

information.

Also, I wonder where the ‘event’ is coming from? The IDE doesn’t recognize it and also I’m not able to tell

where it’s injected (if so)… Do you have any suggestions on this?

 

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM
To: [hidden email]
odehaus.org
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 

Reply | Threaded
Open this post in threaded view
|

RE: Server Push - HowTo?

tacrom
In reply to this post by Eamonn O'Connell-2

Hey Eamonn,

sorry for not  being clear on definition. For me, _server push_ means communication

from Server to Client without a primer client request.

So:

 

Server ==> Client

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursday, February 1
4, 2013 9:51 AM
To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

Hey Heniz, 

 

Is server push Server -> Client, or Client -> Server ?

 

Eamonn

 

On 14 February 2013 09:37, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)

 

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

zyro
In reply to this post by tacrom
m3 is like really old and if you fire your event without a namespace its
using the default one which is "app", not "browser" so your listener not
being invoked seems logical ;)

zyro

-------- Original Message  --------
Subject: Re: [grails-user] Server Push - HowTo?
From: Heinz Romirer | TAC GmbH <[hidden email]>
To: '[hidden email]' <[hidden email]>
Date: Thu, 14 Feb 2013 09:20:18 +0000

> Hello Stephane,
>
> I set up the project from scratch, added  ‘:platform-core:1.0.M6’ and
> ‘:events-push:1.0.M3’ plugins
>
> and added the ‘savedTodo’ event to my “PushEvents.groovy” file, residing
> in ‘grails-app/conf’ directory.
>
> Like:
>
> <code>
>
> events = {
>
>   ‘savedTodo’ browser: true
>
> }
>
> </code>
>
>  
>
> After that I created my Service class as ‘PushService.groovy’ and
> defined the ‘savedTodo’ method like:
>
> <code>
>
> import grails.events.Listener
>
>  
>
> class PushService {
>
>   @Listener(namespace = ‘browser’)
>
>   def savedTodo(Map data) {
>
>     println(data)
>
>     data.moreData = ‘There we go’
>
>     event.(‘savedTodo’, data, {})
>
> }
>
> }
>
> </code>
>
>  
>
> And even if I tried several attempts of invoking the push functionality
> from the browser via JavaScript,
>
> I see that the ‘savedTodo’ method is never touched, so I see no output
> on the console, I get no debugging
>
> information.
>
> Also, I wonder where the ‘event’ is coming from? The IDE doesn’t
> recognize it and also I’m not able to tell
>
> where it’s injected (if so)… Do you have any suggestions on this?
>
>  
>
>  
>
> *From:*Stephane Maldini [mailto:[hidden email]]
> *Sent:* Thursday, February 14, 2013 9:49 AM
> *To:* [hidden email]
> *Subject:* Re: [grails-user] Server Push - HowTo?
>
>  
>
> How that Events Push doesn't work out of the box ?
>
>  
>
> On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH
> <[hidden email] <mailto:[hidden email]>> wrote:
>
> This question may be asked a few times since the start of Grails, but as
> I’m now on to go to checkout
>
> several plugins to provide me with a _/server push/_ functionality I
> feel like I have to ask on this mailing
>
> list if anybody has a project up and running which is using this
> technology to notify connected clients/
>
> browsers of server events and how it is implemented.
>
>  
>
> The reason I’m asking this is, that I tried to get along with several
> Grails plugins, such as Events Push Plugin,
>
> Atmosphere Plugin and CometD Plugin but nothing seems to work out of the
> box  - Atmosphere was the
>
> only solution I got to work after several try/fail roundtrips but still
> it shows some unexpected behavior when
>
> it stops working all of a sudden and the chat example couldn’t be used
> any more. After some browser restarts
>
> it behaves like it should but this can’t be predicted and it seems odd
> to me too.
>
> Also I followed along only the chat example and I can’t figure out how I
> would implement a _/server push/_
>
> to all connected clients/browsers as I’m not shure how to get a
> AtmosphereResource out of the blue…?
>
>  
>
> So, to come to a point: has anybody a current project which makes use of
> the _/server push/_ technology and
>
> could give me some advice on how to implement it in a Grails project
> from scratch? Are there any known good
>
> tutorials which provide a code which could be run without hassle?
>
>  
>
> Every single answer is much appreciated ;)
>
>
>
>  
>
> --
>
> *Stéphane*
>
> --
>
>  
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: Server Push - HowTo?

tacrom
In reply to this post by smaldini

Sorry, I forgot my JavaScript code… here it is:

 

<code>

    <r:require modules="grailsEvents"/>

    <r:script>

        var data = {'id': 'your123Id', 'name' : 'ranger joe'};

        var grailsEvents = new grails.Events("http://localhost:8085/EventsPushTryout");

        grailsEvents.send('savedTodo', data);

        grailsEvents.on("savedTodo", function(data) {

            console.log(data);

            $("#simplImpl").append(data);

        });

    </r:script>

</code>

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM
To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

Eamonn O'Connell-2
In reply to this post by tacrom
Thanks for clarifying Heinz. 
I'm still a little confused though as the example you just gave Stephane looks like Client ==> Server rather than Server ===> Client.


On 14 February 2013 10:27, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Hey Eamonn,

sorry for not  being clear on definition. For me, _server push_ means communication

from Server to Client without a primer client request.

So:

 

Server ==> Client

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursday, February 1
4, 2013 9:51 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

Hey Heniz, 

 

Is server push Server -> Client, or Client -> Server ?

 

Eamonn

 

On 14 February 2013 09:37, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)

 


Reply | Threaded
Open this post in threaded view
|

RE: Server Push - HowTo?

tacrom

@Eamonn:

Yeah, it looks like this because I just followed the simple steps on the Push Events Plugin

GitHub page and that’s Client è Server …

 

@Stephane:

Sorry for bothering you with my problems, yesterday I tested several plugins and it seems

that it was not my day at all. After rechecking my whole project (just after you asked what

went wrong specifically) I came across a typo in the method’s name and *drumroll* this solved

the problem and everything works as expected! J

 

Thanks a lot for asking what went wrong so I had to slurp through my project once again, otherwise

I would never found the error…

 

@Zyro:

After I fixed the typo, all worked well, even with M3. Nevertheless I upgraded to M7 and platform-core

RC5 J

 

@all:

Thanks a lot for your help!

 

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursd
ay, February 14, 2013 10:37 AM
To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

Thanks for clarifying Heinz. 

I'm still a little confused though as the example you just gave Stephane looks like Client ==> Server rather than Server ===> Client.

 

On 14 February 2013 10:27, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Hey Eamonn,

sorry for not  being clear on definition. For me, _server push_ means communication

from Server to Client without a primer client request.

So:

 

Server ==> Client

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursday, February 1
4, 2013 9:51 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

Hey Heniz, 

 

Is server push Server -> Client, or Client -> Server ?

 

Eamonn

 

On 14 February 2013 09:37, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

Eamonn O'Connell-2
In reply to this post by tacrom
I haven't ever used Client ==> Server so I can't comment on it - though seeing your examples has me wanting to try. 
The Server ==> Client does work well for me.
I suggest, just getting the Server ==> Client working, would help to compartmentalize things a bit. 
Create a controller that will trigger your saveTodo event, and see if you see the necessary in your browser console.

class TestController {
  def savedTodo{
    event(topic:'savedTodo', data: [testData:"testData"])
  }
}

If that doesn't work one thing you could try is to define a namespace for your events. 

event(for:'myApp', topic:'savedTodo', data: [testData:'testDAta')

There is also a browseFilter that can be defined in the Events artefact which can help with debugging.

events = {

  'savedTodo' namespace:'myApp, browser:true, browserFilter: { message, request ->    
     return true
  }

}




On 14 February 2013 10:30, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Sorry, I forgot my JavaScript code… here it is:

 

<code>

    <r:require modules="grailsEvents"/>

    <r:script>

        var data = {'id': 'your123Id', 'name' : 'ranger joe'};

        var grailsEvents = new grails.Events("http://localhost:8085/EventsPushTryout");

        grailsEvents.send('savedTodo', data);

        grailsEvents.on("savedTodo", function(data) {

            console.log(data);

            $("#simplImpl").append(data);

        });

    </r:script>

</code>

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 


Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

Eamonn O'Connell-2
Sent that a little early. Gmail short keys!

events = {

  'savedTodo' namespace:'myApp', browser:true, browserFilter: { message, request ->    
     println "savedTodo event raised"
     return true
  }

}


On 14 February 2013 11:00, Eamonn O'Connell <[hidden email]> wrote:
I haven't ever used Client ==> Server so I can't comment on it - though seeing your examples has me wanting to try. 
The Server ==> Client does work well for me.
I suggest, just getting the Server ==> Client working, would help to compartmentalize things a bit. 
Create a controller that will trigger your saveTodo event, and see if you see the necessary in your browser console.

class TestController {
  def savedTodo{
    event(topic:'savedTodo', data: [testData:"testData"])
  }
}

If that doesn't work one thing you could try is to define a namespace for your events. 

event(for:'myApp', topic:'savedTodo', data: [testData:'testDAta')

There is also a browseFilter that can be defined in the Events artefact which can help with debugging.

events = {

  'savedTodo' namespace:'myApp, browser:true, browserFilter: { message, request ->    
     return true
  }

}




On 14 February 2013 10:30, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Sorry, I forgot my JavaScript code… here it is:

 

<code>

    <r:require modules="grailsEvents"/>

    <r:script>

        var data = {'id': 'your123Id', 'name' : 'ranger joe'};

        var grailsEvents = new grails.Events("http://localhost:8085/EventsPushTryout");

        grailsEvents.send('savedTodo', data);

        grailsEvents.on("savedTodo", function(data) {

            console.log(data);

            $("#simplImpl").append(data);

        });

    </r:script>

</code>

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 



Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

Eamonn O'Connell-2
Lastly you could play with the transport method in your javascript. Here is what mine currently looks like:

new grails.Events(baseUrl, { shared:false, logLevel:'debug', maxRequest:70, transport: 'sse', fallbackTransport: 'long-polling' })



On 14 February 2013 11:01, Eamonn O'Connell <[hidden email]> wrote:
Sent that a little early. Gmail short keys!

events = {

  'savedTodo' namespace:'myApp', browser:true, browserFilter: { message, request ->    
     println "savedTodo event raised"
     return true
  }

}


On 14 February 2013 11:00, Eamonn O'Connell <[hidden email]> wrote:
I haven't ever used Client ==> Server so I can't comment on it - though seeing your examples has me wanting to try. 
The Server ==> Client does work well for me.
I suggest, just getting the Server ==> Client working, would help to compartmentalize things a bit. 
Create a controller that will trigger your saveTodo event, and see if you see the necessary in your browser console.

class TestController {
  def savedTodo{
    event(topic:'savedTodo', data: [testData:"testData"])
  }
}

If that doesn't work one thing you could try is to define a namespace for your events. 

event(for:'myApp', topic:'savedTodo', data: [testData:'testDAta')

There is also a browseFilter that can be defined in the Events artefact which can help with debugging.

events = {

  'savedTodo' namespace:'myApp, browser:true, browserFilter: { message, request ->    
     return true
  }

}




On 14 February 2013 10:30, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Sorry, I forgot my JavaScript code… here it is:

 

<code>

    <r:require modules="grailsEvents"/>

    <r:script>

        var data = {'id': 'your123Id', 'name' : 'ranger joe'};

        var grailsEvents = new grails.Events("http://localhost:8085/EventsPushTryout");

        grailsEvents.send('savedTodo', data);

        grailsEvents.on("savedTodo", function(data) {

            console.log(data);

            $("#simplImpl").append(data);

        });

    </r:script>

</code>

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 




Reply | Threaded
Open this post in threaded view
|

RE: Server Push - HowTo?

tacrom
In reply to this post by Eamonn O'Connell-2

Thanks a lot for the examples Eamonn, I appreciate it a lot!

 

In the meanwhile I created a Controller and called the savedTodo method from

my PushService from it. This even works like a charm and I feel like a little champ ;)

But I will try your examples too!

 

Do you have a clue where the “event” comes from within my PushService and what

exactly it is?

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 11:01 AM
To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

I haven't ever used Client ==> Server so I can't comment on it - though seeing your examples has me wanting to try. 

The Server ==> Client does work well for me.

I suggest, just getting the Server ==> Client working, would help to compartmentalize things a bit. 

Create a controller that will trigger your saveTodo event, and see if you see the necessary in your browser console.

 

class TestController {

  def savedTodo{

    event(topic:'savedTodo', data: [testData:"testData"])

  }

}

 

If that doesn't work one thing you could try is to define a namespace for your events. 

 

event(for:'myApp', topic:'savedTodo', data: [testData:'testDAta')

 

There is also a browseFilter that can be defined in the Events artefact which can help with debugging.

 

events = {

 

  'savedTodo' namespace:'myApp, browser:true, browserFilter: { message, request ->    

     return true

  }

 

}

 

 

 

On 14 February 2013 10:30, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Sorry, I forgot my JavaScript code… here it is:

 

<code>

    <r:require modules="grailsEvents"/>

    <r:script>

        var data = {'id': 'your123Id', 'name' : 'ranger joe'};

        var grailsEvents = new grails.Events("http://localhost:8085/EventsPushTryout");

        grailsEvents.send('savedTodo', data);

        grailsEvents.on("savedTodo", function(data) {

            console.log(data);

            $("#simplImpl").append(data);

        });

    </r:script>

</code>

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

Eamonn O'Connell-2
In reply to this post by tacrom
It happens to us all! Glad you have it working. Sometimes it takes something like sending a mail to get out of the slump. 
Events push is the way to go!

Best,
Eamonn


On 14 February 2013 10:57, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

@Eamonn:

Yeah, it looks like this because I just followed the simple steps on the Push Events Plugin

GitHub page and that’s Client è Server …

 

@Stephane:

Sorry for bothering you with my problems, yesterday I tested several plugins and it seems

that it was not my day at all. After rechecking my whole project (just after you asked what

went wrong specifically) I came across a typo in the method’s name and *drumroll* this solved

the problem and everything works as expected! J

 

Thanks a lot for asking what went wrong so I had to slurp through my project once again, otherwise

I would never found the error…

 

@Zyro:

After I fixed the typo, all worked well, even with M3. Nevertheless I upgraded to M7 and platform-core

RC5 J

 

@all:

Thanks a lot for your help!

 

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursd
ay, February 14, 2013 10:37 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

Thanks for clarifying Heinz. 

I'm still a little confused though as the example you just gave Stephane looks like Client ==> Server rather than Server ===> Client.

 

On 14 February 2013 10:27, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Hey Eamonn,

sorry for not  being clear on definition. For me, _server push_ means communication

from Server to Client without a primer client request.

So:

 

Server ==> Client

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursday, February 1
4, 2013 9:51 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

Hey Heniz, 

 

Is server push Server -> Client, or Client -> Server ?

 

Eamonn

 

On 14 February 2013 09:37, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)

 

 


Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

zyro
In reply to this post by tacrom
glad you got it sorted :)

that means default namespace for events sent from client/browser is
"browser" while those being sent from server default to "app",
independently from the browser: true flag, right?

stephane: quick confirmation here? :)

zyro

-------- Original Message  --------
Subject: Re: [grails-user] Server Push - HowTo?
From: Heinz Romirer | TAC GmbH <[hidden email]>
To: '[hidden email]' <[hidden email]>
Date: Thu, 14 Feb 2013 09:57:50 +0000

> @Eamonn:
>
> Yeah, it looks like this because I just followed the simple steps on the
> Push Events Plugin
>
> GitHub page and that’s Client èServer …
>
>  
>
> @Stephane:
>
> Sorry for bothering you with my problems, yesterday I tested several
> plugins and it seems
>
> that it was not my day at all. After rechecking my whole project (just
> after you asked what
>
> went wrong specifically) I came across a typo in the method’s name and
> **drumroll** this solved
>
> the problem and everything works as expected! J
>
>  
>
> Thanks a lot for asking what went wrong so I had to slurp through my
> project once again, otherwise
>
> I would never found the error…
>
>  
>
> @Zyro:
>
> After I fixed the typo, all worked well, even with M3. Nevertheless I
> upgraded to M7 and platform-core
>
> RC5 J
>
>  
>
> @all:
>
> Thanks a lot for your help!
>
>  
>
>  
>
> *From:*Eamonn O'Connell [mailto:[hidden email]]
> *Sent:* Thursday, February 14, 2013 10:37 AM
> *To:* [hidden email]
> *Subject:* Re: [grails-user] Server Push - HowTo?
>
>  
>
> Thanks for clarifying Heinz.
>
> I'm still a little confused though as the example you just gave Stephane
> looks like Client ==> Server rather than Server ===> Client.
>
>  
>
> On 14 February 2013 10:27, Heinz Romirer | TAC GmbH
> <[hidden email] <mailto:[hidden email]>> wrote:
>
> Hey Eamonn,
>
> sorry for not  being clear on definition. For me, _/server push/_ means
> communication
>
> from Server to Client without a primer client request.
>
> So:
>
>  
>
> Server ==> Client
>
>  
>
> *From:*Eamonn O'Connell [mailto:[hidden email]
> <mailto:[hidden email]>]
> *Sent:* Thursday, February 14, 2013 9:51 AM
>
>
> *To:* [hidden email] <mailto:[hidden email]>
> *Subject:* Re: [grails-user] Server Push - HowTo?
>
>  
>
> Hey Heniz,
>
>  
>
> Is server push Server -> Client, or Client -> Server ?
>
>  
>
> Eamonn
>
>  
>
> On 14 February 2013 09:37, Heinz Romirer | TAC GmbH
> <[hidden email] <mailto:[hidden email]>> wrote:
>
> This question may be asked a few times since the start of Grails, but as
> I’m now on to go to checkout
>
> several plugins to provide me with a _/server push/_ functionality I
> feel like I have to ask on this mailing
>
> list if anybody has a project up and running which is using this
> technology to notify connected clients/
>
> browsers of server events and how it is implemented.
>
>  
>
> The reason I’m asking this is, that I tried to get along with several
> Grails plugins, such as Events Push Plugin,
>
> Atmosphere Plugin and CometD Plugin but nothing seems to work out of the
> box  - Atmosphere was the
>
> only solution I got to work after several try/fail roundtrips but still
> it shows some unexpected behavior when
>
> it stops working all of a sudden and the chat example couldn’t be used
> any more. After some browser restarts
>
> it behaves like it should but this can’t be predicted and it seems odd
> to me too.
>
> Also I followed along only the chat example and I can’t figure out how I
> would implement a _/server push/_
>
> to all connected clients/browsers as I’m not shure how to get a
> AtmosphereResource out of the blue…?
>
>  
>
> So, to come to a point: has anybody a current project which makes use of
> the _/server push/_ technology and
>
> could give me some advice on how to implement it in a Grails project
> from scratch? Are there any known good
>
> tutorials which provide a code which could be run without hassle?
>
>  
>
> Every single answer is much appreciated ;)
>
>  
>
>  
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: Server Push - HowTo?

tacrom
In reply to this post by Eamonn O'Connell-2

Thanks a lot – will definitely keep on playin’ around with it J

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 11:04 AM
To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

Lastly you could play with the transport method in your javascript. Here is what mine currently looks like:

 

new grails.Events(baseUrl, { shared:false, logLevel:'debug', maxRequest:70, transport: 'sse', fallbackTransport: 'long-polling' })

 

 

On 14 February 2013 11:01, Eamonn O'Connell <[hidden email]> wrote:

Sent that a little early. Gmail short keys!

 

events = {

 

  'savedTodo' namespace:'myApp', browser:true, browserFilter: { message, request ->    

     println "savedTodo event raised"

     return true

  }

 

}

 

On 14 February 2013 11:00, Eamonn O'Connell <[hidden email]> wrote:

I haven't ever used Client ==> Server so I can't comment on it - though seeing your examples has me wanting to try. 

The Server ==> Client does work well for me.

I suggest, just getting the Server ==> Client working, would help to compartmentalize things a bit. 

Create a controller that will trigger your saveTodo event, and see if you see the necessary in your browser console.

 

class TestController {

  def savedTodo{

    event(topic:'savedTodo', data: [testData:"testData"])

  }

}

 

If that doesn't work one thing you could try is to define a namespace for your events. 

 

event(for:'myApp', topic:'savedTodo', data: [testData:'testDAta')

 

There is also a browseFilter that can be defined in the Events artefact which can help with debugging.

 

events = {

 

  'savedTodo' namespace:'myApp, browser:true, browserFilter: { message, request ->    

     return true

  }

 

}

 

 

 

On 14 February 2013 10:30, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Sorry, I forgot my JavaScript code… here it is:

 

<code>

    <r:require modules="grailsEvents"/>

    <r:script>

        var data = {'id': 'your123Id', 'name' : 'ranger joe'};

        var grailsEvents = new grails.Events("http://localhost:8085/EventsPushTryout");

        grailsEvents.send('savedTodo', data);

        grailsEvents.on("savedTodo", function(data) {

            console.log(data);

            $("#simplImpl").append(data);

        });

    </r:script>

</code>

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

Eamonn O'Connell-2
In reply to this post by tacrom
Happy to hear my typing wasn't wasted :)
The event method is injected into controllers and services by the platform-core plugin. If your using events-push, definitely checkout the events part of platform core - there will be some good examples of syntax, etc.


On 14 February 2013 11:15, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Thanks a lot for the examples Eamonn, I appreciate it a lot!

 

In the meanwhile I created a Controller and called the savedTodo method from

my PushService from it. This even works like a charm and I feel like a little champ ;)

But I will try your examples too!

 

Do you have a clue where the “event” comes from within my PushService and what

exactly it is?

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 11:01 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

I haven't ever used Client ==> Server so I can't comment on it - though seeing your examples has me wanting to try. 

The Server ==> Client does work well for me.

I suggest, just getting the Server ==> Client working, would help to compartmentalize things a bit. 

Create a controller that will trigger your saveTodo event, and see if you see the necessary in your browser console.

 

class TestController {

  def savedTodo{

    event(topic:'savedTodo', data: [testData:"testData"])

  }

}

 

If that doesn't work one thing you could try is to define a namespace for your events. 

 

event(for:'myApp', topic:'savedTodo', data: [testData:'testDAta')

 

There is also a browseFilter that can be defined in the Events artefact which can help with debugging.

 

events = {

 

  'savedTodo' namespace:'myApp, browser:true, browserFilter: { message, request ->    

     return true

  }

 

}

 

 

 

On 14 February 2013 10:30, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Sorry, I forgot my JavaScript code… here it is:

 

<code>

    <r:require modules="grailsEvents"/>

    <r:script>

        var data = {'id': 'your123Id', 'name' : 'ranger joe'};

        var grailsEvents = new grails.Events("http://localhost:8085/EventsPushTryout");

        grailsEvents.send('savedTodo', data);

        grailsEvents.on("savedTodo", function(data) {

            console.log(data);

            $("#simplImpl").append(data);

        });

    </r:script>

</code>

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 

 


Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

smaldini
In reply to this post by zyro
Zyro: Confirmed, it's a whitelist protection to avoid propagating everything to client :)


On Thu, Feb 14, 2013 at 10:22 AM, zyro <[hidden email]> wrote:
glad you got it sorted :)

that means default namespace for events sent from client/browser is
"browser" while those being sent from server default to "app",
independently from the browser: true flag, right?

stephane: quick confirmation here? :)

zyro

-------- Original Message  --------
Subject: Re: [grails-user] Server Push - HowTo?
From: Heinz Romirer | TAC GmbH <[hidden email]>
To: '[hidden email]' <[hidden email]>
Date: Thu, 14 Feb 2013 09:57:50 +0000

> @Eamonn:
>
> Yeah, it looks like this because I just followed the simple steps on the
> Push Events Plugin
>
> GitHub page and that’s Client èServer …
>
>
>
> @Stephane:
>
> Sorry for bothering you with my problems, yesterday I tested several
> plugins and it seems
>
> that it was not my day at all. After rechecking my whole project (just
> after you asked what
>
> went wrong specifically) I came across a typo in the method’s name and
> **drumroll** this solved
>
> the problem and everything works as expected! J
>
>
>
> Thanks a lot for asking what went wrong so I had to slurp through my
> project once again, otherwise
>
> I would never found the error…
>
>
>
> @Zyro:
>
> After I fixed the typo, all worked well, even with M3. Nevertheless I
> upgraded to M7 and platform-core
>
> RC5 J
>
>
>
> @all:
>
> Thanks a lot for your help!
>
>
>
>
>
> *From:*Eamonn O'Connell [mailto:[hidden email]]
> *Sent:* Thursday, February 14, 2013 10:37 AM
> *To:* [hidden email]
> *Subject:* Re: [grails-user] Server Push - HowTo?
>
>
>
> Thanks for clarifying Heinz.
>
> I'm still a little confused though as the example you just gave Stephane
> looks like Client ==> Server rather than Server ===> Client.
>
>
>
> On 14 February 2013 10:27, Heinz Romirer | TAC GmbH
> <[hidden email] <mailto:[hidden email]>> wrote:
>
> Hey Eamonn,
>
> sorry for not  being clear on definition. For me, _/server push/_ means
> communication
>
> from Server to Client without a primer client request.
>
> So:
>
>
>
> Server ==> Client
>
>
>
> *From:*Eamonn O'Connell [mailto:[hidden email]
> <mailto:[hidden email]>]
> *Sent:* Thursday, February 14, 2013 9:51 AM
>
>
> *To:* [hidden email] <mailto:[hidden email]>
> *Subject:* Re: [grails-user] Server Push - HowTo?
>
>
>
> Hey Heniz,
>
>
>
> Is server push Server -> Client, or Client -> Server ?
>
>
>
> Eamonn
>
>
>
> On 14 February 2013 09:37, Heinz Romirer | TAC GmbH
> <[hidden email] <mailto:[hidden email]>> wrote:
>
> This question may be asked a few times since the start of Grails, but as
> I’m now on to go to checkout
>
> several plugins to provide me with a _/server push/_ functionality I
> feel like I have to ask on this mailing
>
> list if anybody has a project up and running which is using this
> technology to notify connected clients/
>
> browsers of server events and how it is implemented.
>
>
>
> The reason I’m asking this is, that I tried to get along with several
> Grails plugins, such as Events Push Plugin,
>
> Atmosphere Plugin and CometD Plugin but nothing seems to work out of the
> box  - Atmosphere was the
>
> only solution I got to work after several try/fail roundtrips but still
> it shows some unexpected behavior when
>
> it stops working all of a sudden and the chat example couldn’t be used
> any more. After some browser restarts
>
> it behaves like it should but this can’t be predicted and it seems odd
> to me too.
>
> Also I followed along only the chat example and I can’t figure out how I
> would implement a _/server push/_
>
> to all connected clients/browsers as I’m not shure how to get a
> AtmosphereResource out of the blue…?
>
>
>
> So, to come to a point: has anybody a current project which makes use of
> the _/server push/_ technology and
>
> could give me some advice on how to implement it in a Grails project
> from scratch? Are there any known good
>
> tutorials which provide a code which could be run without hassle?
>
>
>
> Every single answer is much appreciated ;)
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Stéphane
--

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

smaldini
Glad you sorted it, thanks @Eamonn/@Zyro , you rock as usual.


On Thu, Feb 14, 2013 at 10:38 AM, Stephane Maldini <[hidden email]> wrote:
Zyro: Confirmed, it's a whitelist protection to avoid propagating everything to client :)


On Thu, Feb 14, 2013 at 10:22 AM, zyro <[hidden email]> wrote:
glad you got it sorted :)

that means default namespace for events sent from client/browser is
"browser" while those being sent from server default to "app",
independently from the browser: true flag, right?

stephane: quick confirmation here? :)

zyro

-------- Original Message  --------
Subject: Re: [grails-user] Server Push - HowTo?
From: Heinz Romirer | TAC GmbH <[hidden email]>
To: '[hidden email]' <[hidden email]>
Date: Thu, 14 Feb 2013 09:57:50 +0000

> @Eamonn:
>
> Yeah, it looks like this because I just followed the simple steps on the
> Push Events Plugin
>
> GitHub page and that’s Client èServer …
>
>
>
> @Stephane:
>
> Sorry for bothering you with my problems, yesterday I tested several
> plugins and it seems
>
> that it was not my day at all. After rechecking my whole project (just
> after you asked what
>
> went wrong specifically) I came across a typo in the method’s name and
> **drumroll** this solved
>
> the problem and everything works as expected! J
>
>
>
> Thanks a lot for asking what went wrong so I had to slurp through my
> project once again, otherwise
>
> I would never found the error…
>
>
>
> @Zyro:
>
> After I fixed the typo, all worked well, even with M3. Nevertheless I
> upgraded to M7 and platform-core
>
> RC5 J
>
>
>
> @all:
>
> Thanks a lot for your help!
>
>
>
>
>
> *From:*Eamonn O'Connell [mailto:[hidden email]]
> *Sent:* Thursday, February 14, 2013 10:37 AM
> *To:* [hidden email]
> *Subject:* Re: [grails-user] Server Push - HowTo?
>
>
>
> Thanks for clarifying Heinz.
>
> I'm still a little confused though as the example you just gave Stephane
> looks like Client ==> Server rather than Server ===> Client.
>
>
>
> On 14 February 2013 10:27, Heinz Romirer | TAC GmbH
> <[hidden email] <mailto:[hidden email]>> wrote:
>
> Hey Eamonn,
>
> sorry for not  being clear on definition. For me, _/server push/_ means
> communication
>
> from Server to Client without a primer client request.
>
> So:
>
>
>
> Server ==> Client
>
>
>
> *From:*Eamonn O'Connell [mailto:[hidden email]
> <mailto:[hidden email]>]
> *Sent:* Thursday, February 14, 2013 9:51 AM
>
>
> *To:* [hidden email] <mailto:[hidden email]>
> *Subject:* Re: [grails-user] Server Push - HowTo?
>
>
>
> Hey Heniz,
>
>
>
> Is server push Server -> Client, or Client -> Server ?
>
>
>
> Eamonn
>
>
>
> On 14 February 2013 09:37, Heinz Romirer | TAC GmbH
> <[hidden email] <mailto:[hidden email]>> wrote:
>
> This question may be asked a few times since the start of Grails, but as
> I’m now on to go to checkout
>
> several plugins to provide me with a _/server push/_ functionality I
> feel like I have to ask on this mailing
>
> list if anybody has a project up and running which is using this
> technology to notify connected clients/
>
> browsers of server events and how it is implemented.
>
>
>
> The reason I’m asking this is, that I tried to get along with several
> Grails plugins, such as Events Push Plugin,
>
> Atmosphere Plugin and CometD Plugin but nothing seems to work out of the
> box  - Atmosphere was the
>
> only solution I got to work after several try/fail roundtrips but still
> it shows some unexpected behavior when
>
> it stops working all of a sudden and the chat example couldn’t be used
> any more. After some browser restarts
>
> it behaves like it should but this can’t be predicted and it seems odd
> to me too.
>
> Also I followed along only the chat example and I can’t figure out how I
> would implement a _/server push/_
>
> to all connected clients/browsers as I’m not shure how to get a
> AtmosphereResource out of the blue…?
>
>
>
> So, to come to a point: has anybody a current project which makes use of
> the _/server push/_ technology and
>
> could give me some advice on how to implement it in a Grails project
> from scratch? Are there any known good
>
> tutorials which provide a code which could be run without hassle?
>
>
>
> Every single answer is much appreciated ;)
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Stéphane
--




--
Stéphane
--

Reply | Threaded
Open this post in threaded view
|

Re: Server Push - HowTo?

smaldini
In reply to this post by tacrom
Don't forget to make any feedbacks if you need new features etc.


On Thu, Feb 14, 2013 at 10:22 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Thanks a lot – will definitely keep on playin’ around with it J

 

From: Eamonn O'Connell [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 11:04 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

Lastly you could play with the transport method in your javascript. Here is what mine currently looks like:

 

new grails.Events(baseUrl, { shared:false, logLevel:'debug', maxRequest:70, transport: 'sse', fallbackTransport: 'long-polling' })

 

 

On 14 February 2013 11:01, Eamonn O'Connell <[hidden email]> wrote:

Sent that a little early. Gmail short keys!

 

events = {

 

  'savedTodo' namespace:'myApp', browser:true, browserFilter: { message, request ->    

     println "savedTodo event raised"

     return true

  }

 

}

 

On 14 February 2013 11:00, Eamonn O'Connell <[hidden email]> wrote:

I haven't ever used Client ==> Server so I can't comment on it - though seeing your examples has me wanting to try. 

The Server ==> Client does work well for me.

I suggest, just getting the Server ==> Client working, would help to compartmentalize things a bit. 

Create a controller that will trigger your saveTodo event, and see if you see the necessary in your browser console.

 

class TestController {

  def savedTodo{

    event(topic:'savedTodo', data: [testData:"testData"])

  }

}

 

If that doesn't work one thing you could try is to define a namespace for your events. 

 

event(for:'myApp', topic:'savedTodo', data: [testData:'testDAta')

 

There is also a browseFilter that can be defined in the Events artefact which can help with debugging.

 

events = {

 

  'savedTodo' namespace:'myApp, browser:true, browserFilter: { message, request ->    

     return true

  }

 

}

 

 

 

On 14 February 2013 10:30, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

Sorry, I forgot my JavaScript code… here it is:

 

<code>

    <r:require modules="grailsEvents"/>

    <r:script>

        var data = {'id': 'your123Id', 'name' : 'ranger joe'};

        var grailsEvents = new grails.Events("http://localhost:8085/EventsPushTryout");

        grailsEvents.send('savedTodo', data);

        grailsEvents.on("savedTodo", function(data) {

            console.log(data);

            $("#simplImpl").append(data);

        });

    </r:script>

</code>

 

From: Stephane Maldini [mailto:[hidden email]]
Sent: Thursday, February 14, 2013 9:49 AM


To: [hidden email]
Subject: Re: [grails-user] Server Push - HowTo?

 

How that Events Push doesn't work out of the box ?

 

On Thu, Feb 14, 2013 at 8:37 AM, Heinz Romirer | TAC GmbH <[hidden email]> wrote:

This question may be asked a few times since the start of Grails, but as I’m now on to go to checkout

several plugins to provide me with a _server push_ functionality I feel like I have to ask on this mailing

list if anybody has a project up and running which is using this technology to notify connected clients/

browsers of server events and how it is implemented.

 

The reason I’m asking this is, that I tried to get along with several Grails plugins, such as Events Push Plugin,

Atmosphere Plugin and CometD Plugin but nothing seems to work out of the box  - Atmosphere was the

only solution I got to work after several try/fail roundtrips but still it shows some unexpected behavior when

it stops working all of a sudden and the chat example couldn’t be used any more. After some browser restarts

it behaves like it should but this can’t be predicted and it seems odd to me too.

Also I followed along only the chat example and I can’t figure out how I would implement a _server push_

to all connected clients/browsers as I’m not shure how to get a AtmosphereResource out of the blue…?

 

So, to come to a point: has anybody a current project which makes use of the _server push_ technology and

could give me some advice on how to implement it in a Grails project from scratch? Are there any known good

tutorials which provide a code which could be run without hassle?

 

Every single answer is much appreciated ;)



 

--

Stéphane

--

 

 

 

 




--
Stéphane
--

12