---
title: "URLSessionWebSocketTask.Message.string(_:)"
framework: foundation
role: symbol
role_heading: Case
path: "foundation/urlsessionwebsockettask/message/string(_:)"
---

# URLSessionWebSocketTask.Message.string(_:)

A WebSocket message that contains a string.

## Declaration

```swift
case string(String)
```

## Discussion

Discussion The URLSessionWebSocketTask uses UTF-8 encoding to send the message’s string.

## See Also

### Message types

- [URLSessionWebSocketTask.Message.data(_:)](foundation/urlsessionwebsockettask/message/data(_:).md)
