mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add sessions cursors.
This commit is contained in:
@ -21,6 +21,7 @@ const (
|
||||
SESSION_DELETED = "session/deleted"
|
||||
SESSION_PROFILE = "session/profile"
|
||||
SESSION_STATE = "session/state"
|
||||
SESSION_CURSORS = "session/cursors"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -87,6 +87,12 @@ type SessionData struct {
|
||||
State types.SessionState `json:"state"`
|
||||
}
|
||||
|
||||
type SessionCursor struct {
|
||||
ID string `json:"id"`
|
||||
X uint16 `json:"x"`
|
||||
Y uint16 `json:"y"`
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Control
|
||||
/////////////////////////////
|
||||
|
@ -12,6 +12,11 @@ var (
|
||||
ErrSessionLoginDisabled = errors.New("session login disabled")
|
||||
)
|
||||
|
||||
type Cursor struct {
|
||||
X int
|
||||
Y int
|
||||
}
|
||||
|
||||
type SessionState struct {
|
||||
IsConnected bool `json:"is_connected"`
|
||||
IsWatching bool `json:"is_watching"`
|
||||
@ -23,8 +28,8 @@ type Session interface {
|
||||
State() SessionState
|
||||
IsHost() bool
|
||||
|
||||
// cursor position
|
||||
SetPosition(x, y int)
|
||||
// cursor
|
||||
SetCursor(x, y int)
|
||||
|
||||
// websocket
|
||||
SetWebSocketPeer(websocketPeer WebSocketPeer)
|
||||
@ -50,6 +55,9 @@ type SessionManager interface {
|
||||
GetHost() Session
|
||||
ClearHost()
|
||||
|
||||
SetCursor(x, y int, session Session)
|
||||
PopCursors() map[Session]Cursor
|
||||
|
||||
Broadcast(event string, payload interface{}, exclude interface{})
|
||||
AdminBroadcast(event string, payload interface{}, exclude interface{})
|
||||
|
||||
|
Reference in New Issue
Block a user