websocket_messaging.py error on multiple connections

28 views
Skip to first unread message

Omicron VT

unread,
Jan 23, 2017, 10:10:34 PM1/23/17
to web2py-users
Following the example in websocket_messaging.py i have this config:

A tv.html view that refresh its content when an event on client.html sends a message to group1

All of this works fine if tv.html is opened only 1 time.

When i open tv.html more than one time when first message is sended, tv.html begins an infinite loop refreshing for ever.

Any ideas ? 

Marlysson Silva

unread,
Jan 24, 2017, 9:15:51 AM1/24/17
to web2py-users
Show me the code.. So stay more easy help

Luciano Bovio

unread,
Jan 24, 2017, 10:02:32 AM1/24/17
to web...@googlegroups.com
/controllers/tv.py
def index():
return dict()

-----------------------------------------

/controllers/client.py
from gluon.contrib.websocket_messaging import websocket_send
def index():
m1=websocket_send('http://127.0.0.1:8888', 'Mensaje a grupo 1',
'mykey', 'mygroup1')
return dict()

------------------------------------------

/views/tv/index.html
{{extend 'layout.html'}}
PRUEBA DE ERROR EN WEBSOCKET - TV1
<h2>Ahora : {{=request.now}}</h2>
<script>
$(document).ready(function(){
// si hay mensaje :

if(!$.web2py.web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup1',
function(){
document.location.reload(true);
}))
//si no soporta navegador
alert("html5 websocket not supported by your browser, try
Google Chrome");
});
</script>

-----------------------------------------

/views/client/index.html
{{extend 'layout.html'}}
ENVIANDO MENSAJE A GRUPO 1

--------------------------------------------

I have attached the .w2p file if it helps.

Thanks


El 24/01/17 a las 11:15, Marlysson Silva escribió:
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/-AizF_k-PXA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+un...@googlegroups.com
> <mailto:web2py+un...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

web2py.app.error_ws.w2p
Reply all
Reply to author
Forward
0 new messages