Skip to main content
Community Maintained - This SDK is functional but receives limited maintenance. For production use, we recommend the TypeScript SDK or Python SDK.

Creating a Session

SessionOptions

Available Models

Methods

connect

Connect to the server and initialize the session.

send

Send a message to Claude.

receive

Receive the next message.

close

Close the session.

getId

Get the session ID.

getState

Get the current session state.

Session States

Event Handlers

Message Types

AssistantMessage

Message from Claude.

ResultMessage

Final result of the conversation.

SystemMessage

System events.

ErrorMessage

Error messages.

ControlMessage

Control messages.

Full Example with Message Loop

Resuming Sessions

Resume an existing session:

Multi-turn Conversations