Pithikos / python-websocket-server

A simple fully working websocket-server in Python with no external dependencies
MIT License
1.13k stars 380 forks source link

[feature] connected(client) #81

Closed kkdd closed 4 years ago

kkdd commented 4 years ago

Hello, I would like connected(client), which returns true when being connected and false when left, as follows:

def new_client(client, server):
  while connected(client):
    server.send_message(client, 'Hello.')
    time.sleep(1)
Pithikos commented 4 years ago

Just have a global boolean and switch it on/off for different events (new_client and client_left).