websocket client

12 views
Skip to first unread message

Anders Persson

unread,
Jul 18, 2019, 3:29:05 PM7/18/19
to Eiffel Web Framework
Hi

I tried the example contrib/library/network/websocket/client/example/ws_client/application.e

and running towards 

create ws_client.make_with_port ("ws://echo.websocket.org", 80, Void)

works

Then I tried to connect to 


which I built as a docker image.


The connection works but the handshake fails. I get this message:

HTTP/1.1 400 Bad Request
Connection: close
Content-type: text/html
Content-Length: 11

which does not indicate what goes wrong.

From debugging the client sends:

GET / HTTP/1.1%R
Host: anders-ubuntu-server.local:9000
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: fPjCzeMiEsxW00rWXPR+lQ==
Sec-WebSocket-Version: 13

Any ideas of where I should investigate further?

Anders

Anders Persson

unread,
Jul 22, 2019, 2:39:00 AM7/22/19
to Eiffel Web Framework
Hi

I finally found the problem. This is from the server documentation:

Running PeerServer behind a reverse proxy

Make sure to set the proxied option, otherwise IP based limiting will fail. The option is passed verbatim to the expressjs trust proxy setting if it is truthy.

const PeerServer = require('peer').PeerServer;
const server = PeerServer({port: 9000, path: '/myapp', proxied: true});

I changed in the server to "true" as default and then it worked. However, I did not find out how to pass "proxied: true" to the server.

Anders

Jocelyn Fiat

unread,
Jul 24, 2019, 4:57:54 AM7/24/19
to eiffel-web-framework
Hi,
Thanks for the feedback, this is really helpful for anyone willing to play with websocket and proxy.

However I don't understand all of your last message.
Do you search a way to pass "proxied: true"from the client side?
Or this is more a server setting?
Could you share the documentation link where you found that information?

-- Jocelyn

--
--
You received this message because you are subscribed to the Google
Groups "Eiffel Web Framework" group.
 
To post to this group, send email to
eiffel-web...@googlegroups.com
To unsubscribe from this group, send email to
eiffel-web-frame...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/eiffel-web-framework
 
See the site for the Eiffel-Web-Framework project at
https://github.com/EiffelWebFramework/EWF
---
You received this message because you are subscribed to the Google Groups "Eiffel Web Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-web-frame...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-web-framework/8c276d3b-9c34-4001-9667-2d71073778fe%40googlegroups.com.


--
Jocelyn
------------------------------------------------------------------------
Eiffel Software
https://www.eiffel.com
Customer support: https://support.eiffel.com
User group: https://groups.google.com/forum/#!forum/eiffel-users
------------------------------------------------------------------------

Anders Persson

unread,
Jul 30, 2019, 2:12:05 PM7/30/19
to Eiffel Web Framework google groups
Hi

On Wed, 24 Jul 2019 at 10:57, Jocelyn Fiat <jf...@eiffel.com> wrote:
Hi,
Thanks for the feedback, this is really helpful for anyone willing to play with websocket and proxy.

However I don't understand all of your last message.
Do you search a way to pass "proxied: true"from the client side?

Yes I did that but it is not a severe problem since I just changed the default in the server instead,
 
Or this is more a server setting?

Normally the client should tell the server. At least according to the implementation, but since it is intended to be run as your own server it is not a big problem.
 
Could you share the documentation link where you found that information?

It is the link that I wrote in my first message, but below a direct link to the right heading.:

 
Reply all
Reply to author
Forward
0 new messages