Not open source yet... but

540 views
Skip to first unread message

mdipierro

unread,
Dec 28, 2010, 1:55:37 AM12/28/10
to web2py-users

weheh

unread,
Dec 28, 2010, 3:10:56 AM12/28/10
to web2py-users
Very cool. Also enjoyed your Lagrange talk.

On Dec 28, 1:55 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> http://vimeo.com/18232653

qqsaqq

unread,
Dec 28, 2010, 3:14:40 AM12/28/10
to web...@googlegroups.com
+1

that impressively shows what is possible with html5.

I hope, 'they' get the websocket protocol fixed soon

Martin.Mulone

unread,
Dec 28, 2010, 5:22:27 AM12/28/10
to web...@googlegroups.com
Look really good.

LightDot

unread,
Dec 28, 2010, 12:11:54 PM12/28/10
to web...@googlegroups.com
Very nice!

I hope we'll be able to take a peak at the source code in the future.

David Marko

unread,
Dec 28, 2010, 12:27:43 PM12/28/10
to web...@googlegroups.com
Why tornado as webserver? Any observations you can share?

David

mdipierro

unread,
Dec 28, 2010, 1:04:31 PM12/28/10
to web2py-users
I needed something that could do http get, http post and comet via
html5 websockets.

I looked at the other options gevent, twisted, etc, I either had
installation problems, or performance issues, or it was hard to figure
it out how to it.

With tornado this was trivial:

----- begin ------
LISTENERS = []
class NewMsgHandler(tornado.web.RequestHandler):
def get(self):
self.write('<html><body>Hello</body></html>')
def post(self):
data = self.request.arguments['data'][0]
[element.write_message(data) for element in LISTENERS]
class RealtimeHandler(tornado.websocket.WebSocketHandler):
def open(self):
LISTENERS.append(self)
def on_message(self, message):
pass
def on_close(self):
LISTENERS.remove(self)
application = tornado.web.Application([
(r'/', NewMsgHandler), # for get and post
(r'/websocket/', RealtimeHandler), # for websockets
], auto_reload=True)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
---- end ----

On post it streams data to all clients connected with websockets. It
runs as fast as bare metal. It cannot possibly be faster. I tried with
up with 100 posts/seconds with 10 connected clients) and 1 post/second
with 500 connected clients (my my laptop which does not even support
epoll).

Web2py acts like a proxy for the post (does the form generation,
validation, database IO, etc.) but stays out of the way as far as
websockets are concerned. Web2py serves all the pages that need db
access.

The clients receive data from tornado and store (do not process it
else slows down the server, it queues it). The processing.js thread
processes the data 5times/second for a smooth interface.

Massimo

Albert Abril

unread,
Dec 28, 2010, 1:13:59 PM12/28/10
to web...@googlegroups.com
I think Orbited has the feature of emulate websocket. 
--
Albert Abril,
@desmondo

Bruno Rocha

unread,
Dec 28, 2010, 1:28:29 PM12/28/10
to web...@googlegroups.com
I Guess that Cyclone with RESTMQ is a good option for that. (I read about it)

mdipierro

unread,
Dec 28, 2010, 1:29:42 PM12/28/10
to web2py-users
I was talking serverside code.

Client-side my app only works with Chrome but I am looking into these:
https://github.com/gimite/web-socket-js
http://socket.io/

The second looks really nice.

On Dec 28, 12:13 pm, Albert Abril <albert.ab...@gmail.com> wrote:
> I think Orbited has the feature of emulate websocket.http://orbited.org/wiki/WebSocket

mikech

unread,
Dec 29, 2010, 11:12:25 AM12/29/10
to web2py-users
Very Impressive!

mdipierro

unread,
Dec 29, 2010, 6:38:09 PM12/29/10
to web2py-users

Manu

unread,
Dec 30, 2010, 5:46:41 PM12/30/10
to web...@googlegroups.com
It is awesome, like it .
Just looking at the video i have learn a lot of new tools( websocket,
processing.js, html5 canvas ) . Even if i understood that web2py was
the main tool here , would it be possible to have the websocket part
of rocket so that we can play with this kind of tool too ( i am
working on windows ! )


You do great Massimo !!

mdipierro

unread,
Dec 30, 2010, 6:04:56 PM12/30/10
to web2py-users
From my previous post:

----- begin ------
LISTENERS = []
class NewMsgHandler(tornado.web.RequestHandler):
def get(self):
self.write('<html><body>Hello</body></html>')
def post(self):
data = self.request.arguments['data'][0]
[element.write_message(data) for element in LISTENERS]
class RealtimeHandler(tornado.websocket.WebSocketHandler):
def open(self):
LISTENERS.append(self)
def on_message(self, message):
pass
def on_close(self):
LISTENERS.remove(self)
application = tornado.web.Application([
(r'/', NewMsgHandler), # for get and post
(r'/websocket/', RealtimeHandler), # for websockets
], auto_reload=True)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
---- end ----

this is tornado code for websocket.

On Dec 30, 4:46 pm, Manu <swel...@gmail.com> wrote:
> It is awesome, like it .
> Just  looking at the video i have learn a lot of new tools( websocket,
> processing.js, html5 canvas ) . Even if i understood that web2py was
> the main tool here , would it be possible to have the websocket part
> of rocket so that we can play with this kind of tool too ( i am
> working on windows ! )
>
> You do great Massimo !!
>

mdipierro

unread,
Dec 30, 2010, 7:07:17 PM12/30/10
to web2py-users
Give it a try:

http://web2py.com/trading

Mind that this is running on a 400MHz VPS that also runs web2py.com
(high traffic) and another 20 web sites of mine. Sorry, still not
ready to release the code because I am ashamed, but I will.

Massimo

mdipierro

unread,
Dec 30, 2010, 7:32:26 PM12/30/10
to web2py-users

mikech

unread,
Jan 4, 2011, 10:53:27 PM1/4/11
to web...@googlegroups.com
I cross posted a thread onto the Tornado Group since I thought this application might be of interest to the readers there. Here is the link: https://groups.google.com/d/topic/python-tornado/MmaQBUx4tyg/discussion.  I hope that the discussion here promotes some interest in that group as well.

Lorin Rivers

unread,
Jan 6, 2011, 9:56:18 AM1/6/11
to web...@googlegroups.com
Thanks, Massimo!

Looking forward to checking out the processing stuff!

On Dec 30, 2010, at 18:32 , mdipierro wrote:

> Source: http://code.google.com/p/emte-trading/
>
--
Lorin Rivers
Mosasaur: Killer Technical Marketing <http://www.mosasaur.com>
<mailto:lri...@mosasaur.com>
512/203.3198 (m)


Massimo Di Pierro

unread,
Jun 9, 2012, 11:44:02 PM6/9/12
to web...@googlegroups.com
This

 (T('Index'),URL('index').xml()==URL().xml(),URL('index'),[]),

should be

 (T('Index'),URL('index')==URL(),URL('index'),[]),

On Saturday, 9 June 2012 15:57:02 UTC-5, tonton wrote:
hie im looking at the source code... i think i have most of the infrastructure in place... but to start log2db.py i run into the following error..

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 205, in restricted
    exec ccode in environment
  File "applications/trading/models/menu.py", line 7, in <module>
    (T('Index'),URL('index').xml()==URL().xml(),URL('index'),[]),
AttributeError: 'str' object has no attribute 'xml'

can some please point me in the right direction to solving this. i have cracked my head for two days and i feel like i am missing something very simple

tonton

unread,
Jun 10, 2012, 3:58:16 PM6/10/12
to web...@googlegroups.com
thanks i managed to figure it out with a bit of thinking... thank you for getting back to me and for providing the source code for this. its going to be a long bumpy road but when all is done i hope to walk away from this with deeper knowledge of web sockets... right now i have problems with the trade  interface updating with the data from as well as pushing the orders to the matching engine.. if i cant figure it out in like a week, i will come find you. thanks again

Nomad

unread,
Jun 11, 2012, 1:22:31 PM6/11/12
to web...@googlegroups.com
i was intrested in checking this out but there appears to be no source available at the posted url. Is there somewhere i can get a look at this ?


I'm currently working on a websockets project using web2py as a front end and this would be a good teaching tool

Lucian Davies

unread,
Jun 12, 2012, 7:57:06 AM6/12/12
to web...@googlegroups.com
okay so i figured it was because i was putting in the wrong urls. so
used looked at the matching server and the robot to see how they
communicated and i found it... when i entered the WS:// url it
reflects that a web-socket connection has been established but still
no data comes on the screen. i then searched a bit and discovered that
some browsers have problems with web-sockets i think i am sorted
there. so now i think its how the site outputs the input. but before i
jump into those java scripts. i want to make sure im using the latest
tornado + python 2.7 and apache. should i be using something different

Lucian Davies

unread,
Jun 12, 2012, 11:41:26 PM6/12/12
to web...@googlegroups.com
okay i need help.. do you have any idea of what i am missing that
would stop the trading page not only to respond to my clicks but also
not update with orders already done by the trade robot.. i have a
feeling that its something i have to modify apache to do but i dont
know where to start... so if you can please briefly explain to me how
you set it up i would be very grateful.
Reply all
Reply to author
Forward
0 new messages