Hi,

One thing to understand is that WebSocket does not need a browser to
function. You can directly invoke a websocket endpoint through your JAX-RS
service. There are Java WebSocket clients available that can do this.
Checkout Tyrus [1].

You can also refer the AS websocket test cases for a sample. [2]

[1] https://tyrus.java.net/documentation/1.11/user-guide.html#d0e78
[2]
https://github.com/wso2/product-as/blob/master/modules/integration/tests-integration/tests/src/test/java/org/wso2/appserver/integration/tests/webapp/websocket/EchoWebSocketTestCase.java#L55

On Fri, Jul 3, 2015 at 10:15 PM, Sabra Ossen <[email protected]> wrote:

> Hi All,
>
> I am a newbie but was able to create a basic jax-rs web service and a
> simple chat application based on web sockets.
>
> My requirement is to create a curl client through which I can push data to
> a browser which has web sockets enabled (the simple chat application [1]
> implemented with a curl client). I am finding it hard to understand how to
> build the connection between the jax-rs web service and the web socket
> implementation.
>
> I have attached a diagram of the communication process between the jax-rs
> web service and the browser based on my understanding about the domain.
> Initially I make a rest call through the curl client and send a message to
> the jax-rs web service which loads the html file containing the js file to
> connect to the web socket end point. The jax-rs web service and web sockets
> server both are deployed in the same web app in the AS>
>
> So far I have created a jax-rs web service which returns an html file as
> response to the rest call. The code is specified below.
>
>
>
>
>
>
>
>
>
>
>
> *@Path("/hello")public class HelloService
> { @GET @Produces({MediaType.TEXT_HTML}) @Path("/{message}") public
> InputStream sayHello(@PathParam("message") String name) throws
> FileNotFoundException {  File file = new File(HTML_FILE_PATH);  return new
> FileInputStream(file); }}*
>
> But I am unable to pass the parameter (message) to the html file using by
> the above method.
>
> Could anyone give me any insight on $subject and also clarify my approach
> taken.
>
> Thanks.
>
> [1] https://blog.idrsolutions.com/2013/12/websockets-an-introduction/
>
> --
> Sabra Ossen <http://lk.linkedin.com/in/sabraossen>
> Undergraduate | Department of Computer Science and Engineering
> University of Moratuwa
> Sri Lanka
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

*Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
email: kasung AT spamfree wso2.com
linked-in: http://lk.linkedin.com/in/gajasinghe
blog: http://kasunbg.org
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to