This works fine by overriding onMessage in your test class and adding this
crude html to your html.

java:
protected void onMessage(WebSocketRequestHandler handler, TextMessage
message)
{
                        LOG.info(message.getText());

}

html:

<button onclick="Wicket.WebSocket.send('message');">PRESS ME</button>


Long story longer, I was able to use chrome console to hack a bad test,
Martin or other contributors, is there an up to date example for the native
websockets, or a simple point me into the right direction to better
understand how to implement a better real world use case, both to test the
WICKET-5733 and just to learn about the wicket way to implement native
websocket code.

Thanks,
John


On Fri, Oct 24, 2014 at 2:17 PM, John Sarman <[email protected]> wrote:

> Yeah, I am just trying to trigger the onMessage at this point mainly just
> to learn more about the native websocket package at the moment.  So I am
> just adding a button in html and adding some inline js to the onclick.
> First attempt I copy pasted var ws = new Wicket.WebSocket();
> ws.send('message'); from the wiki into the onclick and got a exception in
> the chrome console stating cannot send message while in the connecting
> state.  Assuming I need to learn more here, but I will keep probing at this
> mainly as an effort to learn how to use the wicket native websockets.
>
>
>
> On Fri, Oct 24, 2014 at 2:11 PM, Sebastien <[email protected]> wrote:
>
>> Hi John,
>>
>> If you get the "client connected" message and no stacktrace, we are good I
>> guess :)
>>
>> I will investigate on my side given your previous answer...
>>
>> Thanks again,
>> Sebastien
>> On Oct 24, 2014 7:58 PM, "John Sarman" <[email protected]> wrote:
>>
>> > Sebastian,
>> > Just updated my snapshots, clean built wicket, changed the dependency to
>> > 7.0.0-SNAPSHOT and all seems well running on Wildfly.  Is there
>> something
>> > else I need to do to trigger your error.  Currently page comes up with
>> the
>> > label  7.0.0-SNAPSHOT. I even checked my .m2 repo to verify my jar files
>> > had proper timestamp, which they did.  I went so far as to clone wicket,
>> > build, and test app.  Is there a way to trigger the websocket push,
>> because
>> > currently log file only states:
>> >
>> > 13:40:19,258 ERROR [stderr] (default task-1)
>> > ********************************************************************
>> > 13:40:19,259 ERROR [stderr] (default task-1) *** WARNING: Wicket is
>> running
>> > in DEVELOPMENT mode.              ***
>> > 13:40:19,259 ERROR [stderr] (default task-1) ***
>> >     ^^^^^^^^^^^                    ***
>> > 13:40:19,259 ERROR [stderr] (default task-1) *** Do NOT deploy to your
>> live
>> > server(s) without changing this.  ***
>> > 13:40:19,259 ERROR [stderr] (default task-1) *** See
>> > Application#getConfigurationType() for more information. ***
>> > 13:40:19,259 ERROR [stderr] (default task-1)
>> > ********************************************************************
>> > 13:40:21,592 INFO  [com.mycompany.HomePage] (default task-7) Client
>> > connected
>> >
>> > where the relevant part is the last log statement stating websocket is
>> > connected to client.
>> >
>> > I would like to see if the log message from onPush works fine, but
>> unsure
>> > how to test this ATM.
>> >
>> > Hope this helps,
>> > John
>> >
>> >
>> >
>> > On Fri, Oct 24, 2014 at 12:03 PM, Sebastien <[email protected]> wrote:
>> >
>> > > Hi,
>> > >
>> > > On Fri, Oct 24, 2014 at 6:00 PM, Martin Grigorov <
>> [email protected]>
>> > > wrote:
>> > >
>> > > > John,
>> > > >
>> > > > The quickstart uses 7.0.0-M3.
>> > > >
>> > >
>> > > Oops, right! I'm really sorry for that! I probably wanted to test a
>> last
>> > > time it was not repro in -M3...
>> > >
>> > >
>> > >
>> > > > Sebastien said that the problem is in 7.0.0-SNAPSHOT.
>> > > >
>> > > > Martin Grigorov
>> > > > Wicket Training and Consulting
>> > > > https://twitter.com/mtgrigorov
>> > > >
>> > > > On Fri, Oct 24, 2014 at 6:51 PM, John Sarman <[email protected]>
>> > > wrote:
>> > > >
>> > > > > Sebastian,
>> > > > > I also deployed your quickstart in wildfly-8.0Final with no
>> changes,
>> > > and
>> > > > > all seems well.  As for the quickstart test, you would need to use
>> > > > cdi-unit
>> > > > > as a test dependency to enable the cdi aspects for the
>> wicket-tester.
>> > > To
>> > > > > successfully add that please look at the test section in the
>> > > > wicket-cdi-1.1
>> > > > > code.  In there you will find an extended version of WicketTester
>> > that
>> > > > > properly starts and stops the different contexts.  Without using a
>> > > > package
>> > > > > like cdi-unit or arquillian, I am afraid you will always get a
>> > Context
>> > > > > based exception because there is no cdi service provider
>> activated.
>> > > > >
>> > > > > On Fri, Oct 24, 2014 at 11:15 AM, John Sarman <
>> [email protected]>
>> > > > > wrote:
>> > > > >
>> > > > > > I was able to start your test app in Glassfish4 without changes.
>> > > > > >
>> > > > > > For Tomcat I added
>> > > > > >                  <dependency>
>> > > > > > <groupId>org.jboss.weld</groupId>
>> > > > > > <artifactId>weld-core</artifactId>
>> > > > > > <version>2.1.2.Final</version>
>> > > > > > </dependency>
>> > > > > > <dependency>
>> > > > > > <groupId>org.jboss.weld.servlet</groupId>
>> > > > > > <artifactId>weld-servlet-core</artifactId>
>> > > > > > <version>2.1.2.Final</version>
>> > > > > > </dependency>
>> > > > > > to the pom.
>> > > > > >
>> > > > > > I then added
>> > > > > > <listener>
>> > > > > > <!-- initialize Weld in servlet environment -->
>> > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
>> > > > > > </listener>
>> > > > > >
>> > > > > > to web.xml
>> > > > > >
>> > > > > > The homepage then loaded fine as well.  If you look in
>> > > wicket-examples
>> > > > > you
>> > > > > > can find these CDI related additions to the pom.xml and the
>> > web.xml.
>> > > > > >
>> > > > > > Hope this helps
>> > > > > >
>> > > > > > John Sarman
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > On Fri, Oct 24, 2014 at 4:12 AM, Sebastien <[email protected]>
>> > wrote:
>> > > > > >
>> > > > > >> Hi Martin,
>> > > > > >>
>> > > > > >> On Thu, Oct 23, 2014 at 8:27 PM, Martin Grigorov <
>> > > > [email protected]>
>> > > > > >> wrote:
>> > > > > >>
>> > > > > >> > Ticket please.
>> > > > > >> > With quickstart will be processed sooner ;-)
>> > > > > >> >
>> > > > > >>
>> > > > > >> Fair :)
>> > > > > >> https://issues.apache.org/jira/browse/WICKET-5733
>> > > > > >>
>> > > > > >> Best regards,
>> > > > > >> Sebastien.
>> > > > > >>
>> > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
>
>

Reply via email to