Starscream: Where socket.headers from version 3.0.0? )

Created on 26 Sep 2017  路  2Comments  路  Source: daltoniam/Starscream

Where socket.headers from version 3.0.0? )

Most helpful comment

For the lazy (which includes me so ... no shame 馃槃 )
Find in your code where you call
socket = WebSocket(url: serverUrl, protocols: proto) socket.headers = headers
Replace with:
var request = URLRequest(url: serverUrl) request.timeoutInterval = 5 for (key,value) in headers { request.setValue(value, forHTTPHeaderField: key) } socket = WebSocket(request: request, protocols: proto)

All 2 comments

https://github.com/daltoniam/Starscream#custom-headers

It has been replaced by URLRequest in the init. I felt that was more inline with standard Apple APIs.

For the lazy (which includes me so ... no shame 馃槃 )
Find in your code where you call
socket = WebSocket(url: serverUrl, protocols: proto) socket.headers = headers
Replace with:
var request = URLRequest(url: serverUrl) request.timeoutInterval = 5 for (key,value) in headers { request.setValue(value, forHTTPHeaderField: key) } socket = WebSocket(request: request, protocols: proto)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LondonAtlas picture LondonAtlas  路  3Comments

francos picture francos  路  3Comments

sadeghrz picture sadeghrz  路  4Comments

lveselovsky picture lveselovsky  路  3Comments

milanstevanovic picture milanstevanovic  路  5Comments