     fileprivate func sendMessage(event: String, data: Any){
         
         let msg = ["event": event, "data": data]
+        print("SENDING:")
+        print(msg)
         sendMessage(msg)
     }
     

    
    fileprivate func handleServerMessage(msg: JSON){
        
        print(msg)

        if let event = msg["event"].string{

    
    /** Called any time the IceConnectionState changes. */
    public func peerConnection(_ peerConnection: RTCPeerConnection, didChange newState: RTCIceConnectionState){
        switch newState {
        case .failed:
            sendPeerMessage(messageType: "connectivityError", payload: nil)
            print("ERROR: RTCPeer:RTCPeerConnectionDelegate: peer ice failed")
        case .connected:
            sendPeerMessage(messageType: "endOfCandidates", payload: nil)
            print("RTCPeer:RTCPeerConnectionDelegate: peer ice state connected")
        case .completed:
            print("RTCPeer:RTCPeerConnectionDelegate: peer ice state completed")
        default:
            print("RTCPeer:RTCPeerConnectionDelegate: peer connection ice state did change")
        }
        
        
    }
    
    
