Skip to content

Commit

Permalink
fix for tinode#826 - login after reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Jan 25, 2023
1 parent 27b440f commit 0a6a103
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chatbot/python/chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
unicode = str

APP_NAME = "Tino-chatbot"
APP_VERSION = "1.2.1"
APP_VERSION = "1.2.2"
LIB_VERSION = pkg_resources.get_distribution("tinode_grpc").version

# Maximum length of string to log. Shorten longer strings.
Expand Down Expand Up @@ -215,7 +215,7 @@ def note_read(topic, seq):
return pb.ClientMsg(note=pb.ClientNote(topic=topic, what=pb.READ, seq_id=seq))

def init_server(listen):
# Launch plugin server: acception connection(s) from the Tinode server.
# Launch plugin server: accept connection(s) from the Tinode server.
server = grpc.server(futures.ThreadPoolExecutor(max_workers=16))
pbx.add_PluginServicer_to_server(Plugin(), server)
server.add_insecure_port(listen)
Expand All @@ -242,7 +242,6 @@ def init_client(addr, schema, secret, cookie_file_name, secure, ssl_host):
# Session initialization sequence: {hi}, {login}, {sub topic='me'}
client_post(hello())
client_post(login(cookie_file_name, schema, secret))
client_post(subscribe('me'))

return stream

Expand Down Expand Up @@ -302,6 +301,8 @@ def read_auth_cookie(cookie_file_name):
return schema, secret

def on_login(cookie_file_name, params):
client_post(subscribe('me'))

"""Save authentication token to file"""
if params == None or cookie_file_name == None:
return
Expand Down

0 comments on commit 0a6a103

Please sign in to comment.