Created Event Handles (markdown)

dharm pimsen 2024-03-17 20:26:53 +07:00
parent 4524e91b41
commit 61dcf48ef8

78
Event-Handles.md Normal file

@ -0,0 +1,78 @@
# Event Handles
To handle the event can use `on_user()` decorator
```py
ssh = Server()
@ssh.on_user("...")
def ...(channel, data, client):
...
```
# event lists
channel is socket
client is client manager
## connect
Called when user connected to server and authenticated
**output** channel, client
**return** True/False
## auth
Called when user press enter to server and authenticating
**output** channel, data, client
### data
```py
{
"username": ...,
"password": ...,
}
```
## connectpty
Called when user connected to server and authenticated
**output** channel, data, client
### data
```py
{
"term": ...,
"width": ...,
"height": ...,
"pixelwidth": ...,
"pixelheight": ...,
"modes": ...
}
```
## resized
Called when user resized terminal
**output** channel, data, client
### data
```py
{
"width": ...,
"height": ...,
"pixelwidth": ...,
"pixelheight": ...
}
```
## command
Called when user entered command
**output** channel, command, client
## error
Called when inside command event error
**output** channel, error, client
## disconnected
Called when inside command event error
**output** peername, client