Skip to content

Instantly share code, notes, and snippets.

@codeAshu
Last active July 13, 2018 04:49
Show Gist options
  • Save codeAshu/f6384203706e989b0d38db6e0a9d11e7 to your computer and use it in GitHub Desktop.
Save codeAshu/f6384203706e989b0d38db6e0a9d11e7 to your computer and use it in GitHub Desktop.
Change these two functions in pyrebase to avoid the problem in closing stream.
class ClosableSSEClient(SSEClient):
def close(self):
self.should_connect = False
self.retry = 0
try:
self.resp.raw._fp.fp._sock.shutdown(socket.SHUT_RDWR)
self.resp.raw._fp.fp._sock.close()
except AttributeError:
pass
class Stream:
def close(self):
while not self.sse and not hasattr(self.sse, 'resp'):
time.sleep(0.001)
self.sse.running = False
self.sse.close()
#comment out join
# self.thread.join()
return self
@the-c0d3r
Copy link

the-c0d3r commented Jul 13, 2018

@PreshantAhar You can edit the file by logging in to your raspberry pi and use nano or vim to edit the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment