newSession creates a new session wrapper with the given session ID and client.
(sessionID string, client *jsonrpc2.Client, workspacePath string)
| 360 | |
| 361 | // newSession creates a new session wrapper with the given session ID and client. |
| 362 | func newSession(sessionID string, client *jsonrpc2.Client, workspacePath string) *Session { |
| 363 | s := &Session{ |
| 364 | SessionID: sessionID, |
| 365 | workspacePath: workspacePath, |
| 366 | client: client, |
| 367 | clientSessionAPIs: &rpc.ClientSessionAPIHandlers{}, |
| 368 | handlers: make([]sessionHandler, 0), |
| 369 | toolHandlers: make(map[string]ToolHandler), |
| 370 | commandHandlers: make(map[string]CommandHandler), |
| 371 | eventCh: make(chan SessionEvent, 128), |
| 372 | RPC: rpc.NewSessionRPC(client, sessionID), |
| 373 | } |
| 374 | s.clientSessionAPIs.Canvas = newCanvasClientSessionAdapter(s) |
| 375 | s.clientSessionAPIs.ProviderToken = newProviderTokenClientSessionAdapter(s) |
| 376 | go s.processEvents() |
| 377 | return s |
| 378 | } |
| 379 | |
| 380 | // Send sends a message to this session and waits for the response. |
| 381 | // |
no test coverage detected
searching dependent graphs…