 class @Cable
   MAX_CONNECTION_ATTEMPTS: 10
   MAX_CONNECTION_INTERVAL: 5 * 1000
-  MAX_PING_INTERVAL: 6
+  PING_STALE_INTERVAL: 6
 
   constructor: (@cableUrl) ->
     @subscribers = {}

      @subscribers[data.identifier]?.onReceiveData(data.message)

  connected: =>
    @resetConnectionAttemptsCount()

    for identifier, callbacks of @subscribers

      @connection.send JSON.stringify { action: 'unsubscribe', identifier: identifier }

  pingReceived: (timestamp) =>
    if @lastPingTime? and (timestamp - @lastPingTime) > @PING_STALE_INTERVAL
      console.log "Websocket connection is stale. Reconnecting.."
      @connection?.close()
    else
      @startWaitingForPing()
      @lastPingTime = timestamp
