Skip to content

Instantly share code, notes, and snippets.

@codeAshu
Last active July 13, 2018 04:49
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
@AwesomeJ0sh
Copy link

What is the best way to add this to the pyrebase library?

@PrashantAhar
Copy link

PrashantAhar commented Jul 4, 2018

The Pyrebase.py file is not editable in raspberry PI in headless mode . what to do, how to do these changes in that file. i have installed pyre base through terminal. please help

@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