def chat_receive(window_info, content=''): matcher = re.match('^@([\w\-_]+).*', content) if matcher: dest = 'chat-%s' % matcher.group(1) else: dest = BROADCAST scall(window_info, 'demo.chat.send', to=[WINDOW, dest], content=content)
def print_sig2(window_info, content=''): scall(window_info, 'notify', to=[BROADCAST, SERVER], content="Server notification [%r]" % content, level='warning', timeout=2, style='notification')
def slow_signal(window_info, content=''): logger.warn('wait for 10 seconds…') time.sleep(10) logger.warn('10 seconds: done.') scall(window_info, 'demo.print_sig2', to=[BROADCAST, SERVER], content='slow result')
def print_sig1(window_info, content=''): logger.debug('Debug log message [%r]' % content) logger.info('Debug info message [%r]' % content) logger.warn('Debug warn message [%r]' % content) logger.error('Debug error message [%r]' % content) scall(window_info, 'demo.print_sig2', to=[BROADCAST, SERVER], content=content)
def check_websockets(window_info): logger.info('websocket OK') scall(window_info, 'ed.monitoring.checked_ws', to=[WINDOW])