File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -33,19 +33,21 @@ def close(self):
3333
3434class RemoteThread (threading .Thread ):
3535
36- def __init__ (self , URL , function ):
36+ def __init__ (self , parent , URL , function ):
3737 self .function = function
3838 self .URL = URL
39+ self .parent = parent
3940 super (RemoteThread , self ).__init__ ()
4041
4142 def run (self ):
4243 try :
4344 self .sse = ClosableSSEClient (self .URL )
4445 for msg in self .sse :
4546 msg_data = json .loads (msg .data )
46- msg_event = msg .event
4747 if msg_data is None : # keep-alives
4848 continue
49+ msg_event = msg .event
50+ # TODO: update parent cache here
4951 self .function ((msg .event , msg_data ))
5052 except socket .error :
5153 pass # this can happen when we close the stream
@@ -85,7 +87,8 @@ def firebaseURL(URL):
8587class subscriber :
8688
8789 def __init__ (self , URL , function ):
88- self .remote_thread = RemoteThread (firebaseURL (URL ), function )
90+ self .cache = {}
91+ self .remote_thread = RemoteThread (self , firebaseURL (URL ), function )
8992
9093 def start (self ):
9194 self .remote_thread .start ()
You can’t perform that action at this time.
0 commit comments