Re: [Twisted-Python] Protocol for socket.io

2014-01-26 Thread Tobias Oberstein
Hi Laurens,

>Hm. I can't find it in the current version. Either I am misremembering, or 
>they expect you to use the pubsub thing as an RPC mechanism somehow (i.e. the 
>room name is the procedure name).

I see. Using PubSub to implement RPC seems hackish at best, if it works at all. 
E.g. how to make sure only 1 implementing endpoint subscribes to the Room (to 
receive procedure calls), how to direct call results to calling clients (since 
only the caller should receive his result), etc etc

Unsurprisingly (probably), I'd like to point to WAMP: http://wamp.ws/

Which was designed from the ground up for exactly this: 1 protocol that covers 
_both_ RPC and PubSub, and runs over WebSocket.

Autobahn|Python implements both WebSocket and WAMP 
(https://github.com/tavendo/AutobahnPython)

End of marketing message;)

/Tobias

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Protocol for socket.io

2014-01-26 Thread Laurens Van Houtven
Hi Tobias,


Hm. I can't find it in the current version. Either I am misremembering, or
they expect you to use the pubsub thing as an RPC mechanism somehow (i.e.
the room name is the procedure name).

hth
lvh
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Protocol for socket.io

2014-01-26 Thread Tobias Oberstein
>socket.io adds a few things like "RPC support" and "pubsub", ...

Do you have pointers for that?

I can see socket.io supports "topic based pubsub" like functionality via 
"rooms" : https://github.com/LearnBoost/socket.io/wiki/Rooms

What about RPC?

/Tobias


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] twisted.web secured session cookies and multiple sites on same host

2014-01-26 Thread Adi Roiban
Hi,

I am looking for the followings:
* Force twisted.web to set session cookie as secured when HTTPS is used.
* Allow 2 separate twisted.web Sites to run on same host/IP but with
different sessions.

I have checked the current code for getSession() [1] but i can see that
session cookie is harcoded and I don't know how to use self.sitepath .

I tried to search the code for sitepath, but I only got this comment, which
I things is used to suppport some some sort of load balancing / high
availability.

# Sitepath is used to determine cookie names between distributed
# servers and disconnected sites.

Can this be done with current code?

If not, I am happy to submit a ticket and a patch.

To solve my problems I rewrote getSession to not use harcoded session name
and to check for self.isSecure before setting a new session cookie.

Many thanks!

[1] https://github.com/twisted/twisted/blob/trunk/twisted/web/server.py#L384
-- 
Adi Roiban
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Protocol for socket.io

2014-01-26 Thread Laurens Van Houtven
On Sun, Jan 26, 2014 at 10:57 AM, Glyph  wrote:

>
> Having had the life-transforming experience of supporting customers using
> *Government-*Quality Web Middleware Server Hardware Firewallâ„¢, in a
> pre-websockets world, with a two-way web application...
>
> No, no I probably wouldn't.
>

Hah; okay, fair enough: that was just a generic warning to those of us who
have not had to stare into the Black Goat of the Rack with a Thousand
Permanently Quiet Sockets...

cheers
lvh
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Protocol for socket.io

2014-01-26 Thread Glyph

On Jan 26, 2014, at 1:53 AM, Laurens Van Houtven <_...@lvh.io> wrote:

> you'd be amazed how much Enterprise Quality Web Middleware Server Hardware 
> Firewall(TM) screws up websocket connections

Having had the life-transforming experience of supporting customers using 
Government-Quality Web Middleware Server Hardware Firewallâ„¢, in a 
pre-websockets world, with a two-way web application...

No, no I probably wouldn't.

-glyph___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Protocol for socket.io

2014-01-26 Thread Laurens Van Houtven
On Sun, Jan 26, 2014 at 10:46 AM, Glyph  wrote:

> It would be great if someone built a package to do this (more interop is
> always better), but I think interest has generally fizzled on Socket.IO
> implementations in the past because SockJS does pretty much exactly the
> same thing, and as Laurens said, our friends over at Desert Bus for Hope
> maintain great Twisted support for it <
> https://github.com/DesertBus/sockjs-twisted> <
> https://pypi.python.org/pypi/txsockjs>.
>

socket.io adds a few things like "RPC support" and "pubsub", both those are
things that should be spoken over some transport, not part of some
transport, and are trivial to layer over an existing browser transport.

I like SockJS because it's literally just "websockets damnit!". Also, it
doesn't use Flash, which has excellent benefits including no gnarly XML
files to server and not having to wait three seconds to figure out if a
connection works or not (yes, really).

Also: protip, speak SockJS over TLS exclusively. It's not even a security
thing (except yes, that too), but if you do end up speaking websockets
you'd be amazed how much Enterprise Quality Web Middleware Server Hardware
Firewall(TM) screws up websocket connections. TLS, OTOH, they just leave be.

hth
lvh
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Protocol for socket.io

2014-01-26 Thread Glyph

On Jan 25, 2014, at 12:21 PM, Dustin J. Mitchell  wrote:

> As I understand it, socket.io is a browser-side library that uses any
> of a number of technologies, depending on its environment, to
> communicate with the server.  SSE, Websockets, and long polling are
> all on the list.  Last I looked, though, I didn't see any support for
> the negotiation of which of these protocols to use with a Twisted
> server.
> 
> If that's changed, I'd certainly be interested!

It would be great if someone built a package to do this (more interop is always 
better), but I think interest has generally fizzled on Socket.IO 
implementations in the past because SockJS does pretty much exactly the same 
thing, and as Laurens said, our friends over at Desert Bus for Hope maintain 
great Twisted support for it  
.

It even has endpoints support, including a string parser!  
.

Socket.IO is just a negotiation protocol for deciding whether to use websockets 
though.  If you started with Autobahn I can't imagine it would be more than a 
day or two of work to implement.

-glyph___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python