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)

  Print Answers RSS
0 OriginalGriff 565
1 Maciej Los 319
2 Richard MacCutchan 220
3 BillWoodruff 164
4 Mathew Soji 160
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.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