Instance Method インスタンスメソッド

webSocketTaskWithRequest:

Creates a WebSocket task for the provided URL request. WebSocketタスクをこの提供されたURLリクエストに対して作成します。

Declaration 宣言

- (NSURLSessionWebSocketTask *)webSocketTaskWithRequest:(NSURLRequest *)request;

Parameters パラメータ

request

A URL request that indicates a WebSockets endpoint with which to connect. あるURLリクエスト、それはそれと接続するところのWebSocketsエンドポイントを指し示します。

Discussion 議論

You can modify the request’s properties prior to calling resume on the task. The task uses these properties during the HTTP handshake phase. あなたは、リクエストのもつプロパティを修正することが、resumeをタスク上で呼び出すことに先だって可能です。タスクは、これらプロパティをHTTPハンドシェイク段階の間に使います。

To add custom protocols, add a header with the key Sec-WebSocket-Protocol, and a comma-separated list of protocols you want to negotiate with the server. The custom HTTP headers provided by the client remain unchanged for the handshake with the server. あつらえのプロトコルを加えるには、あるヘッダをキーSec-WebSocket-Protocol、そしてあなたがサーバと交渉したいプロトコルそれらからなるコンマ区切りリストととも加えてください。クライアントによって提供されたあつらえのHTTPヘッダは、サーバとのハンドシェイクに対して変更されないままです。

See Also 参照

Adding WebSocket Tasks to a Session WebSocketタスクをセッションに加える