#NEWLINE# def open( self ) : #NEWLINE# #INDENT# print ( 'WebSocket opened' ) #NEWLINE# self . subject = Subject ( ) #NEWLINE# query = self . subject . map ( ( lambda x : x [ 'term' ] ) ) . filter ( ( lambda text : ( len ( text ) > 2 ) ) ) . debounce ( 0.75 , scheduler = scheduler ) . distinct_until_changed ( ) #NEWLINE# searcher = query . flat_map_latest ( search_wikipedia ) #NEWLINE# def send_response( x ) : #NEWLINE# #INDENT# self . write_message ( x . body ) #NEWLINE# #UNINDENT# def on_error( ex ) : #NEWLINE# #INDENT# print ( ex ) #NEWLINE# #UNINDENT# searcher . subscribe ( send_response , on_error )