users@tyrus.java.net

Re: Only Client APIs with JDK ?

From: Andy Moncsek <amo.ahcp_at_gmail.com>
Date: Thu, 21 Feb 2013 14:49:50 +0100

Hi, did you managed to run this example? I have the same issue wit gassfish
b76 and tyrus 1.0-b11. Nothing is printed and Session session =
container.connectToServer(MyClientEndpoint.class, URI.create(uri));
session.isOpen() is false.

Thank you


2013/2/19 Arun Gupta <arun.p.gupta_at_oracle.com>

> I connected to the endpoint as:
>
> WebSocketContainer container = ContainerProvider.**
> getWebSocketContainer();
> String uri = "ws://localhost:8080/**scalability/websocket";
> System.out.println("Connecting to " + uri);
> container.connectToServer(**MyClientEndpoint.class,
> URI.create(uri));
>
> Client endpoint is:
>
> @WebSocketClient
> public class MyClientEndpoint {
> @WebSocketOpen
> public void onOpen(Session session) {
> System.out.println("Connected to endpoint: " +
> session.getRemote());
> try {
> String name = "Duke";
> System.out.println("Sending message to endpoint: " + name);
> session.getRemote().**sendString(name);
> } catch (IOException ex) {
> Logger.getLogger(**MyClientEndpoint.class.**getName()).log(Level.SEVERE,
> null, ex);
> }
> }
>
> @WebSocketMessage
> public void processMessage(String message) {
> System.out.println("Received message in client: " + message);
> }
> }
>
> None of the System.outs from ClientEndpoint are printed. Where do I expect
> them ?
>
> Arun
>
>
> On 2/19/13 7:35 AM, Pavel Bucek wrote:
>
>> Hi Arun,
>>
>> you will need:
>>
>> <dependency>
>> <groupId>org.glassfish.tyrus</**groupId>
>> <artifactId>tyrus-client</**artifactId>
>> <version>1.0-SNAPSHOT</**version>
>> </dependency>
>> <dependency>
>> <groupId>org.glassfish.tyrus</**groupId>
>> <artifactId>tyrus-container-**grizzly</artifactId>
>> <version>1.0-SNAPSHOT</**version>
>> </dependency>
>>
>> Regards,
>> Pavel
>>
>> On 2/19/13 3:37 PM, Arun Gupta wrote:
>>
>>> I'd like to use JSR 356 Client APIs with JDK 7. Is there a stand-alone
>>> client.jar that can be used ?
>>>
>>> Arun
>>>
>>>
>>
> --
> http://twitter.com/arungupta
> http://blogs.oracle.com/**arungupta <http://blogs.oracle.com/arungupta>
>
>