websocket clients are registered to socket server with server socket?

151 views
Skip to first unread message

hamba...@gmail.com

unread,
Aug 15, 2018, 5:14:00 AM8/15/18
to noVNC
Hi,

I want to use websockify to get raw socket clients and websocket clients connected together.
Socket server and websockify are running on the same server in one script.

That's how I initiate websocket:

var websockify = require('node-websockify');
websockify
({
    source
: '10.1.10.8:6600',
    target
: '10.1.10.8:4400'
});

Console output is:

WebSocket settings:
   
- proxying from 10.1.10.8:6600 to 10.1.20.8:4400
   
- Running in unencrypted HTTP (ws://) mode


But when I connect with a websocket client, console output will be:

 ::ffff:10.1.6.1: WebSocket connection
 
::ffff:10.1.6.1: Version undefined, subprotocol:
New client (::ffff:10.1.10.8:49480) joined.
 
::ffff:10.1.6.1: connected to target
 
::ffff:10.1.6.1: websocket sending message: Welcome ::ffff:10.1.10.8:49480


What I see is, that the websocket part recognizes my local websocket client socket connection with my ip address.
But the raw socket server recognizes the server ip (line 3: New client joined) and sends the welcome message to the server address too.
My client does not get any notice about it.

Is it possible that websockify pass my local socket connection information to the raw socket server,so that the raw socket server is able to answer to me?

Any help is greatly welcome.


Pierre Ossman

unread,
Aug 15, 2018, 9:59:54 AM8/15/18
to no...@googlegroups.com, hamba...@gmail.com
On 15/08/18 11:14, hamba...@gmail.com wrote:
>
> What I see is, that the websocket part recognizes my local websocket client
> socket connection with my ip address.
> But the raw socket server recognizes the server ip (line 3: New client
> joined) and sends the welcome message to the server address too.
> My client does not get any notice about it.
>
> Is it possible that websockify pass my local socket connection information
> to the raw socket server,so that the raw socket server is able to answer to
> me?
>

I'm not sure what you are asking here. Your raw socket server will only
see the connection from websockify (::ffff:10.1.10.8:49480). It does not
get any information about the WebSocket client at all.

Regards
--
Pierre Ossman Software Development
Cendio AB https://cendio.com
Teknikringen 8 https://twitter.com/ThinLinc
583 30 Linköping https://facebook.com/ThinLinc
Phone: +46-13-214600 https://plus.google.com/+CendioThinLinc

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

hamba...@gmail.com

unread,
Aug 16, 2018, 2:36:03 AM8/16/18
to noVNC


Am Mittwoch, 15. August 2018 15:59:54 UTC+2 schrieb Pierre Ossman:

I'm not sure what you are asking here. Your raw socket server will only
see the connection from websockify (::ffff:10.1.10.8:49480). It does not
get any information about the WebSocket client at all.

 Ok, let me try to explain it with other words...

I have clients which only can use raw sockets and I have webclients which only can use websockets.
Nevertheless, I need to have a solution, that the webclients can communicate with raw socket clients and
aw socket clients can communicate with websocket clients.
I would have expected that the websockify acts as a transparent proxy which means that websockify forwards the socket data from the initial websocket client to the raw socket server.
Or that websockify is able to distribute the data sent from raw socket to websocket to the according websocket clients.

So do I have any chance that the raw socket server gets the socket data from websocket client?


Message has been deleted

hamba...@gmail.com

unread,
Aug 16, 2018, 3:55:31 AM8/16/18
to noVNC
Maybe I have a missunderstanding...
All messages sent through a websocket client are automatically forwarded to the raw socket server.
And vice versa?
Currently I only have a raw socket service. Do I have to setup a websocket server part too?
I'm wondering because I edited the websockify.js to log all messages and don't see any logs after sending messages trough raw sockets?

Pierre Ossman

unread,
Aug 16, 2018, 9:57:08 AM8/16/18
to no...@googlegroups.com, hamba...@gmail.com
On 16/08/18 08:36, hamba...@gmail.com wrote:
>
> Ok, let me try to explain it with other words...
>
> I have clients which only can use raw sockets and I have webclients which
> only can use websockets.
> Nevertheless, I need to have a solution, that the webclients can
> communicate with raw socket clients and
> aw socket clients can communicate with websocket clients.
> I would have expected that the websockify acts as a transparent proxy which
> means that websockify forwards the socket data from the initial websocket
> client to the raw socket server.
> Or that websockify is able to distribute the data sent from raw socket to
> websocket to the according websocket clients.
>
> So do I have any chance that the raw socket server gets the socket data
> from websocket client?
>

websockify is for letting a WebSocket client talk to a raw socket
server, which sounds like what you want. That should work fine. The
confusing part is that you are talking about raw socket _clients_. Those
cannot interact with websockify as it expects all incoming connections
to be using the WebSocket protocol.
Reply all
Reply to author
Forward
0 new messages