title: didReceive(event: WebSocketEvent, client: WebSocket) is not called on socket?.write(string: method in Starscream
body: <p>I am using latest Starscream version of package in my chat application.Please take a look on my code snippet:-</p>
  <pre><code>import UIKit
  import Starscream
  import Network
  
  class ViewController: UIViewController,WebSocketDelegate {
  
  var socket: WebSocket!
  var isConnected = false
  let server = WebSocketServer()
  
  var webSocketTask: URLSessionWebSocketTask!
  var request: URLRequest = URLRequest(url: URL(string: &quot;wss://dev.api.deepak.com/tools/cognitive/channel/web/client&quot;)!)
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
    
      request.setValue(&quot;Q6ZzGUo8q9Tta5QM0jKiZOJ03aQ3ZS&quot;, forHTTPHeaderField: &quot;Sec-WebSocket-Protocol&quot;)
      socket = WebSocket(request: request)
      socket.delegate = self
      socket.connect()
  }
  
  
  func didReceive(event: WebSocketEvent, client: WebSocket) {
      switch event {
      case .connected(let headers):
          isConnected = true
          print(&quot;websocket is connected: \(headers)&quot;)
  
      case .disconnected(let reason, let code):
          isConnected = false
          print(&quot;websocket is disconnected: \(reason) with code: \(code)&quot;)
      case .text(let string):
          print(&quot;Received text: \(string)&quot;)
      case .binary(let data):
          print(&quot;Received data: \(data.count)&quot;)
      case .ping(_):
          break
      case .pong(_):
          break
      case .viabilityChanged(_):
          break
      case .reconnectSuggested(_):
          break
      case .cancelled:
       //   print(error)
          isConnected = false
      case .error(let error):
          isConnected = false
          handleError(error)
         // print(error)
      }
  }
  </code></pre>
  <p>output :-</p>
  <p>websocket is connected: [&quot;Via&quot;: &quot;kong/0.34-1-enterprise-edition&quot;, &quot;Connection&quot;: &quot;Upgrade&quot;, &quot;Server&quot;: &quot;nginx/1.15.6&quot;, &quot;Content-Type&quot;: &quot;text/plain; charset=UTF-8&quot;, &quot;Strict-Transport-Security&quot;: &quot;max-age=15724800; includeSubDomains&quot;, &quot;X-RateLimit-Remaining-20&quot;: &quot;499&quot;, &quot;Access-Control-Expose-Headers&quot;: &quot;X-Auth-Token&quot;, &quot;X-Kong-Upstream-Latency&quot;: &quot;375&quot;, &quot;X-RateLimit-Limit-20&quot;: &quot;500&quot;, &quot;Upgrade&quot;: &quot;websocket&quot;, &quot;X-Kong-Proxy-Latency&quot;: &quot;386&quot;, &quot;Date&quot;: &quot;Thu, 30 Jul 2020 14:28:18 GMT&quot;, &quot;Sec-WebSocket-Protocol&quot;: &quot;Q6ZzGUo8q9Tta5QM0jKiZOJ03aQ3ZS&quot;, &quot;Sec-WebSocket-Accept&quot;: &quot;mkPgQAVeipWtSB+6t7soZQKWXW4=&quot;, &quot;Access-Control-Allow-Credentials&quot;: &quot;true&quot;]</p>
  <p>After that I m sending message:-</p>
  <pre><code>func createChannel()
  {
  let message = [&quot;request_type&quot;:&quot;start&quot;,&quot;bot_id&quot;:&quot;10&quot;]
  
      do {
          let data = try JSONSerialization.data(withJSONObject: message)
          if let dataString = String(data: data, encoding: .utf8){
              self.socket?.write(string: dataString)
              
          }
  
      } catch {
          print(&quot;JSON serialization failed: &quot;, error)
      }
  
  }
  </code></pre>
  <p>it is not returning to didReceive event.</p>
  <h3>my api and expected response :=</h3>
  <p>URL : wss://dev.api.deepak.com/tools/cognitive/channel/web/client
  Header:
  Sec-WebSocket-Protocol:Q6ZzGUo8q9Tta5QM0jKiZOJ03aQ3ZS</p>
  <p>Session start message:</p>
  <p>Request:
  {&quot;request_type&quot;:&quot;start&quot;,&quot;bot_id&quot;:10}</p>
  <p>Response:
  {&quot;session_id&quot;:&quot;1595350205841-86807685-dbc3&quot;,&quot;status&quot;:&quot;success&quot;,&quot;request_type&quot;:&quot;start&quot;}</p>
  <h2>CAN YOU PLEASE GUIDE ME WHAT AM I DOING WRONG?</h2>