Hello,
I'm playing with WebSockets under Pharo4 and this works as expected - when using Pharo4 alone (using the Zinc packages). But I did not get it to work, when e.g. doing a proxying via nginx (I did not check it with Apache). Actually Pharo4 seems to receive some stuff, because the WebSocket of Pharo4 stuff does not work as expected after first proxying attempts. Has anyone experience with that ? Marten |
Marten,
> On 06 May 2015, at 10:15, [hidden email] wrote: > > Hello, > > I'm playing with WebSockets under Pharo4 and this works as expected - > when using Pharo4 alone (using the Zinc packages). > > But I did not get it to work, when e.g. doing a proxying via nginx (I > did not check it with Apache). > > Actually Pharo4 seems to receive some stuff, because the WebSocket of > Pharo4 stuff does not work as expected after first proxying attempts. > > Has anyone experience with that ? > > Marten Proxying the WebSockets protocol is not easy, nor implemented everywhere, like HTTP is. This makes sense if you think about it, a WebSocket connection is a permanent connection, which takes resources, this is not something most servers like. So it is more difficult. Did you see/try http://nginx.org/en/docs/http/websocket.html ? (I did not try it) Sven |
Hmm, at least I managed, that Pharo answered every second request using
the echo example Under Windows and nginx I added to the nginx configuration. My local Pharo server is running under 127.0.0.1:40000: extract from nginx.conf: http:{ map $http_upgrade $connection_upgrade { default upgrade; } server { location /ws-echo { proxy_pass http://127.0.0.1:40000/ws-echo ; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } location /ws-echo-client { proxy_pass http://127.0.0.1:40000/ws-echo-client ; } } } Am 06.05.2015 um 10:20 schrieb Sven Van Caekenberghe: > Marten, > >> On 06 May 2015, at 10:15, [hidden email] wrote: >> >> Hello, >> >> I'm playing with WebSockets under Pharo4 and this works as expected - >> when using Pharo4 alone (using the Zinc packages). >> >> But I did not get it to work, when e.g. doing a proxying via nginx (I >> did not check it with Apache). >> >> Actually Pharo4 seems to receive some stuff, because the WebSocket of >> Pharo4 stuff does not work as expected after first proxying attempts. >> >> Has anyone experience with that ? >> >> Marten > > Proxying the WebSockets protocol is not easy, nor implemented everywhere, like HTTP is. This makes sense if you think about it, a WebSocket connection is a permanent connection, which takes resources, this is not something most servers like. > > So it is more difficult. > > Did you see/try http://nginx.org/en/docs/http/websocket.html ? > > (I did not try it) > > Sven > > -- Marten Feldtmann |
Ok, I managed to make it work somehow:
I removed the static file serving from Pharo and put the "ws-echo-client" code to the file system and it is now handled by nginx. Now only WebSocket stuff is done by Pharo and this seems to work without problems. That means: the mixture of static-stuff and websocket handling breaks the system: browser (Firefox or Chrome or IE11) <-> nginx <-> Pharo Not the solution I wanted, but at least a way to make WebSockets working under Pharo ... Marten Am 06.05.2015 um 16:48 schrieb [hidden email]: > Hmm, at least I managed, that Pharo answered every second request using > the echo example > > Under Windows and nginx I added to the nginx configuration. My local > Pharo server is running under 127.0.0.1:40000: > > extract from nginx.conf: > > http:{ > > map $http_upgrade $connection_upgrade { > default upgrade; > } > > server { > > location /ws-echo { > proxy_pass http://127.0.0.1:40000/ws-echo ; > proxy_http_version 1.1; > proxy_set_header Upgrade $http_upgrade; > proxy_set_header Connection $connection_upgrade; > } > location /ws-echo-client { > proxy_pass http://127.0.0.1:40000/ws-echo-client ; > } > > } > } > > > > Am 06.05.2015 um 10:20 schrieb Sven Van Caekenberghe: >> Marten, >> >>> On 06 May 2015, at 10:15, [hidden email] wrote: >>> >>> Hello, >>> >>> I'm playing with WebSockets under Pharo4 and this works as expected - >>> when using Pharo4 alone (using the Zinc packages). >>> >>> But I did not get it to work, when e.g. doing a proxying via nginx (I >>> did not check it with Apache). >>> >>> Actually Pharo4 seems to receive some stuff, because the WebSocket of >>> Pharo4 stuff does not work as expected after first proxying attempts. >>> >>> Has anyone experience with that ? >>> >>> Marten >> >> Proxying the WebSockets protocol is not easy, nor implemented everywhere, like HTTP is. This makes sense if you think about it, a WebSocket connection is a permanent connection, which takes resources, this is not something most servers like. >> >> So it is more difficult. >> >> Did you see/try http://nginx.org/en/docs/http/websocket.html ? >> >> (I did not try it) >> >> Sven >> >> > > -- Marten Feldtmann |
Good that it works now, maybe your problem is that /ws-echo comes before and maybe also matches /ws-echo-client ? But I am no nginx expert.
Maybe you try serving and proxying it as /client-ws-echo ? Or switch the order ? > On 06 May 2015, at 20:11, [hidden email] wrote: > > Ok, I managed to make it work somehow: > > I removed the static file serving from Pharo and put the > "ws-echo-client" code to the file system and it is now handled by nginx. > > Now only WebSocket stuff is done by Pharo and this seems to work without > problems. > > That means: the mixture of static-stuff and websocket handling breaks > the system: browser (Firefox or Chrome or IE11) <-> nginx <-> Pharo > > Not the solution I wanted, but at least a way to make WebSockets working > under Pharo ... > > Marten > > > > Am 06.05.2015 um 16:48 schrieb [hidden email]: >> Hmm, at least I managed, that Pharo answered every second request using >> the echo example >> >> Under Windows and nginx I added to the nginx configuration. My local >> Pharo server is running under 127.0.0.1:40000: >> >> extract from nginx.conf: >> >> http:{ >> >> map $http_upgrade $connection_upgrade { >> default upgrade; >> } >> >> server { >> >> location /ws-echo { >> proxy_pass http://127.0.0.1:40000/ws-echo ; >> proxy_http_version 1.1; >> proxy_set_header Upgrade $http_upgrade; >> proxy_set_header Connection $connection_upgrade; >> } >> location /ws-echo-client { >> proxy_pass http://127.0.0.1:40000/ws-echo-client ; >> } >> >> } >> } >> >> >> >> Am 06.05.2015 um 10:20 schrieb Sven Van Caekenberghe: >>> Marten, >>> >>>> On 06 May 2015, at 10:15, [hidden email] wrote: >>>> >>>> Hello, >>>> >>>> I'm playing with WebSockets under Pharo4 and this works as expected - >>>> when using Pharo4 alone (using the Zinc packages). >>>> >>>> But I did not get it to work, when e.g. doing a proxying via nginx (I >>>> did not check it with Apache). >>>> >>>> Actually Pharo4 seems to receive some stuff, because the WebSocket of >>>> Pharo4 stuff does not work as expected after first proxying attempts. >>>> >>>> Has anyone experience with that ? >>>> >>>> Marten >>> >>> Proxying the WebSockets protocol is not easy, nor implemented everywhere, like HTTP is. This makes sense if you think about it, a WebSocket connection is a permanent connection, which takes resources, this is not something most servers like. >>> >>> So it is more difficult. >>> >>> Did you see/try http://nginx.org/en/docs/http/websocket.html ? >>> >>> (I did not try it) >>> >>> Sven >>> >>> >> >> > > > -- > Marten Feldtmann > |
Good guess - but this does not help ....
Marten Am 06.05.2015 um 21:24 schrieb Sven Van Caekenberghe: > Good that it works now, maybe your problem is that /ws-echo comes before and maybe also matches /ws-echo-client ? But I am no nginx expert. > > Maybe you try serving and proxying it as /client-ws-echo ? Or switch the order ? > -- Marten Feldtmann |
Free forum by Nabble | Edit this page |