# Session

## SessionBuilder <a href="#session-swifty-sessionbuilder" id="session-swifty-sessionbuilder"></a>

| Return type    | Method                                                          | Description                                  | Params                                                                              |
| -------------- | --------------------------------------------------------------- | -------------------------------------------- | ----------------------------------------------------------------------------------- |
|                | init()                                                          | The default initializer                      |                                                                                     |
| SessionBuilder | withUsername(\_ username: String) -> SessionBuilder             | Specify the username                         | <ul><li><strong>username</strong> - a display name</li></ul>                        |
| SessionBuilder | withDelegate(\_ delegate: SessionDelegate) -> SessionBuilder    | Subscribe a delegate for receiving callbacks | <ul><li><strong>delegate</strong> - an instance for reporting callbacks</li></ul>   |
| SessionBuilder | withCallbackQueue(\_ queue: DispatchQueue) -> SessionBuilder    | Register a queue for receiving callbacks     | <ul><li><strong>queue</strong> - a dispatch queue for reporting callbacks</li></ul> |
| SessionBuilder | withVideoCodec(\_ codec: VideoCodec) -> SessionBuilder          | Specify a video codec type                   | <ul><li><strong>codec</strong> - a video codec type</li></ul>                       |
| SessionBuilder | withVideoRenderer(\_ renderer: VideoRenderer) -> SessionBuilder | Specify a video renderer type                | <ul><li><strong>renderer</strong> - a video renderer type</li></ul>                 |
| Session        | build() -> Session                                              | Construct a session instance                 |                                                                                     |

## Field Summary <a href="#session-swifty-fieldsummary" id="session-swifty-fieldsummary"></a>

| LocalParticipant | localParticipant | Represents a local user                                                       |
| ---------------- | ---------------- | ----------------------------------------------------------------------------- |
| SessionDelegate? | delegate         | An optional delegate for receiving callbacks                                  |
| DispatchQueue    | callbackQueue    | A dispatch queue for receiving callbacks. The default queue is the main queue |
| SessionState     | sessionState     | Enum with current session state                                               |

## Method Summary <a href="#session-swifty-methodsummary" id="session-swifty-methodsummary"></a>

<br>

| Return type      | Methods                                                  | Description                                  | Parameters                                                                                                                                                      |
| ---------------- | -------------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| void             | connect(with token: String)                              | Connect a session                            | <ul><li><strong>token</strong> - authentication token </li></ul>                                                                                                |
| void             | disconnect()                                             | Leave a room and teardown WebRTC session     | <p><br></p>                                                                                                                                                     |
| UIViewController | createLogsViewController()                               | Return view controller with all Session logs | <p><br></p>                                                                                                                                                     |
| void             | sendMessage(message: String)                             | sends message to all conference participants | <ul><li><strong>message</strong> - text to send</li></ul>                                                                                                       |
| void             | forceDisconnect(participantId: String, message: String?) | kick partitipant by id from session          | <p></p><ul><li><strong>participantId</strong> -selected participant id</li><li> <strong>message -</strong> optional supplemental message(kick reason)</li></ul> |

## Static Method Summary <a href="#session-swifty-staticmethodsummary" id="session-swifty-staticmethodsummary"></a>

| Return type | Methods                                 | Description         | Parameters                                                              |
| ----------- | --------------------------------------- | ------------------- | ----------------------------------------------------------------------- |
| void        | setMinLogLevel(\_ logLevel: WTLogLevel) | Specify a log level | <ul><li><strong>logLevel</strong> - a level for logs produced</li></ul> |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.sceenic.co/watch-together-sdk/sscale-confluence-api-references/ios-swift-reference-new/session.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
