Skip to content

Commit

Permalink
Final pass of local -> client.
Browse files Browse the repository at this point in the history
  • Loading branch information
treuille committed Nov 25, 2018
1 parent 3269641 commit 1fcb6ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/streamlit/proxy/ClientWebSocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def open(self, report_name):
self._report_name = report_name
self._report_name = urllib.parse.unquote_plus(self._report_name)
self._connection = None
LOGGER.info('Local websocket opened for %s', self._report_name)
LOGGER.info('Client websocket opened for %s', self._report_name)

@Proxy.stop_proxy_on_exception()
def on_message(self, message):
Expand All @@ -67,15 +67,15 @@ def on_message(self, message):
@gen.coroutine
def on_close(self):
"""Close callback."""
LOGGER.info('Local websocket closed for "%s"' % self._report_name)
LOGGER.info('Client websocket closed for "%s"' % self._report_name)

# Deregistering this connection and see if we can close the proxy.
if self._connection:
# Save the report if proxy.saveOnExit is true.
if config.get_option('proxy.saveOnExit'):
yield self._save_report(self._connection)

self._connection.close_local_connection()
self._connection.close_client_connection()
self._proxy.schedule_potential_deregister_and_stop(
self._connection)
else:
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/proxy/ProxyConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, new_report_msg, name):
# Each connection additionally gets its own queue.
self._browser_queues = []

def close_local_connection(self):
def close_client_connection(self):
"""Close the client connection."""
self._has_client_connection = False
self._master_queue.close()
Expand Down
8 changes: 1 addition & 7 deletions tmp-rename-modules.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
**Note** This file will be deleted! Reviewers, please ignore! These are just notes fro me as I work on this renaming project.

# Step 5

- `LOGGER.info('Local websocket` -> `LOGGER.info('Client websocket`
- `close_local_connection(` -> `close_client_connection(`
- `local_uuid.txt` -> `client_uuid.txt`

---

# PR 3: Fixups
Expand All @@ -14,7 +8,7 @@
- look this up and understand it better `on_browser_waiting_for_proxy_conn`
- `on_browser_waiting_for_proxy_conn(` -> `replace_connection_and_queue(`

- `Called when a client detects it has no corresponding ProxyConnection.` -> `Gets the most recent proxy connection and queue for this report_name. (BrowserWebSocket continuously calls this to in case a new client connection was established in which case we should switch to the new proxy connection and queue.)`
- `Called when a client detects it has no corresponding ProxyConnection.` -> `Gets the most recent proxy connection and queue for this report_name. (BrowserWebSocket continuously calls this to in case a new client connection was established in which case the BrowserWebSocket should switch to the new proxy connection and queue.)`

- little cleanup:
- move `proxy_connection_is_registered` into `on_browser_waiting_for_proxy_conn`
Expand Down

0 comments on commit 1fcb6ab

Please sign in to comment.