Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi ,
 
Im new to html5 websocket , is that possible to establish a connection from websocket to java socket. if it is possible how it can be done .

 
Kindly help me out.
 
Thanks in advace.
Posted 31-Mar-13 21:37pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Exact similar discussion here, marked solved: Can you connect an HTML5 web socket to a Java Socket?[^].
 
...WebSocket works by the client side opening a port 80 connect to the server side, and sending a variant HTTP 1.1 request to the server to negotiate a WebSocket connection. If the server recognizes this, it will send a suitable response, and then allow the still open TCP connection to be used for full-duplex client-server interactions.
 
It looks like it would be possible to quickly put together a server-side that just understood WebSocket negotation and not full HTTP. However, I think you are better off looking at existing WebSocket implementations, including those embedded in HTTP servers / protocol stacks.
 
This Wikipedia page compares a number of WebSocket implementations, and should help you in deciding which server-side implementation to use.
 
But to directly answer your literal question, a WebSocket client can only connect to a WebSocket-aware server; i.e. that one that can perform the initial negotiation.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 1 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100