Opened 6 years ago

Closed 3 years ago

Last modified 10 months ago

#1063 closed enhancement (not a bug)

Add websocket support

Reported by: zzz Owned by:
Priority: minor Milestone:
Component: apps/i2ptunnel Version: 0.9.8.1
Keywords: standards Cc:
Parent Tickets: Sensitive: no

Description

http://forum.i2p/viewtopic.php?t=10766

Hi, All!

I have 2 questions about websockets and i2p:

First:

For example, i have eepsite running under tomcat 7,
and browser application, connected to this site(over tunnel), via websocket.

This site work fine in usual internet, but not works in i2p.

In firebug, i see, that normal address
ws://mysite.i2p/myapp/ws?anyparams
replaced to
http://mysite.i2p/myapp/ws?anyparams,
and, therefore, "NetworkError?: 403 Bad Protocol" occured.
(other stuff of site - loaded normally)

I guess, that reason may be somwhere in proxy configuration,
but dont know where.

So, is any way to fix this problem?

And, second:

For example, i have running web-application
on my local machine, and another application, running on another
mashine (with addres ike ws://yoursite.i2p/yourapp/ws?anyparams).

Can my application connect to another application via websocket
connection or no? How it possible if yes?

Subtickets

Change History (8)

comment:1 Changed 6 years ago by zzz

If we wish to add support in Jetty we would need to bundle the websocket jar (120 KB).
But probably not?
http://wiki.eclipse.org/Jetty/Feature/WebSockets
http://webtide.intalio.com/2011/04/is-websocket-chat-simpler/

comment:2 Changed 6 years ago by killyourtv

Parent Tickets: 1064

comment:3 Changed 5 years ago by str4d

Keywords: standards added

comment:4 Changed 5 years ago by zzz

Parent Tickets: 1064

comment:5 Changed 4 years ago by str4d

Status: newopen

comment:6 Changed 3 years ago by zzz

Resolution: not a bug
Status: openclosed

https://en.wikipedia.org/wiki/Websocket

Proxy traversal
WebSocket? protocol client implementations try to detect if the user agent is configured to use a proxy when connecting to destination host and port and, if it is, uses HTTP CONNECT method to set up a persistent tunnel.

If unencrypted WebSocket? traffic flows through an explicit or a transparent proxy server without WebSockets? support, the connection will likely fail.

—-

If so, we shouldn't need to do anything. If it actually does a GET ws:// … or wss:// … then it will fail unless we allow it. But we are NOT a transparent proxy. We do support CONNECT in the http proxy so all should work fine. As far as support in jetty, people can copy over the websocket jar themselves, or use another server or the ubuntu package.

OP says ws: was "replaced" by http: but by what? Our software or his? There's no info here. So I don't see anything to do here. If anybody has tried it and thinks differently, please reopen.

See also: https://www.infoq.com/articles/Web-Sockets-Proxy-Servers

comment:7 Changed 2 years ago by zzz

update thanks to val in irc:

<val> Hi guys. Is it possible to use Websocket over I2P with HTTP port on client side? I have no luck with both HTTP and Standard tunnels on a server side, the switching doesn't occur.
<val> It works fine if I add server tunnel on a _client_ side, but that's inconvenient.
<val> client tunnel on client side, I mean
<val> It works if I configure both HTTP and HTTPS proxy on a client side. HTTP proxy prevents websocket switching with 403 SSL error
<val> "Allow SSL to I2P addresses" in HTTP proxy settings probabaly should do the trick, would test tomorrow.

<val> Yep, it works that way.
<zzz> val you got websockets working?
<zzz> http://trac.i2p2.i2p/ticket/1063
<val> zzz, yes, but only with "Allow SSL to I2P addresses" in HTTP proxy settings on the client side and standard tunnel on server side.
<zzz> val thanks for the report, I'll update the ticket with your info


note: SSL option in HTTP proxy added in 0.9.14. I don't remember how or if it worked before that.

websockets looks like https to the proxy since it's just CONNECT. Long ago, the http proxy didn't support CONNECT, so it wouldn't have worked. That got fixed but I don't know when.

comment:8 Changed 10 months ago by zzz

for future reference: websockets over HTTP (not HTTPS) are blocked by the proxy, fix in progress, see #2422

Note: See TracTickets for help on using tickets.