// Path: src/main/java/org/nextrtc/signalingserver/domain/Connection.java
// public interface Connection {
//     String getId();
// 
//     boolean isOpen();
// 
//     void sendObject(Object object);
// 
//     void close() throws IOException;
// }
// 
// Path: src/main/java/org/nextrtc/signalingserver/domain/Message.java
// @Getter
// @Builder(builderMethodName = "create")
// @AllArgsConstructor(access = AccessLevel.PRIVATE)
// public class Message {
//     /**
//      * Use Message.create(...) instead of new Message()
//      */
//     @Deprecated
//     Message() {
//     }
// 
//     @Expose
//     private String from = EMPTY;
// 
//     @Expose
//     private String to = EMPTY;
// 
//     @Expose
//     private String signal = EMPTY;
// 
//     @Expose
//     private String content = EMPTY;
// 
//     @Expose
//     private Map<String, String> custom = Maps.newHashMap();
// 
//     @Override
//     public String toString() {
//         return String.format("(%s -> %s)[%s]: %s |%s", from, to, signal, content, custom);
//     }
// }


import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.nextrtc.signalingserver.domain.Connection;
import org.nextrtc.signalingserver.domain.Message;
import java.io.Closeable;
import java.util.function.Function;
import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;
package org.nextrtc.signalingserver.api;




public interface NextRTCServer extends Closeable {

    void register(Connection connection);

    void handle(Message external, Connection connection);

    default void handle(String message, Connection connection) {
        Message decode;
        try {
            decode = MessageDecoder.decode(message);
        } catch (Exception e){
            throw new IllegalArgumentException(e);
        }
        handle(decode, connection);
    }

    void unregister(Connection connection, String reason);

// Path: src/main/java/org/nextrtc/signalingserver/domain/Connection.java
// public interface Connection {
//     String getId();
// 
//     boolean isOpen();
// 
//     void sendObject(Object object);
// 
//     void close() throws IOException;
// }
// 
// Path: src/main/java/org/nextrtc/signalingserver/domain/Message.java
// @Getter
// @Builder(builderMethodName = "create")
// @AllArgsConstructor(access = AccessLevel.PRIVATE)
// public class Message {
//     /**
//      * Use Message.create(...) instead of new Message()
//      */
//     @Deprecated
//     Message() {
//     }
// 
//     @Expose
//     private String from = EMPTY;
// 
//     @Expose
//     private String to = EMPTY;
// 
//     @Expose
//     private String signal = EMPTY;
// 
//     @Expose
//     private String content = EMPTY;
// 
//     @Expose
//     private Map<String, String> custom = Maps.newHashMap();
// 
//     @Override
//     public String toString() {
//         return String.format("(%s -> %s)[%s]: %s |%s", from, to, signal, content, custom);
//     }
// }


// Path: src/main/java/org/nextrtc/signalingserver/api/NextRTCServer.java
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.nextrtc.signalingserver.domain.Connection;
import org.nextrtc.signalingserver.domain.Message;
import java.io.Closeable;
import java.util.function.Function;
import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;

package org.nextrtc.signalingserver.api;




public interface NextRTCServer extends Closeable {

    void register(Connection connection);

    void handle(Message external, Connection connection);

    default void handle(String message, Connection connection) {
        Message decode;
        try {
            decode = MessageDecoder.decode(message);
        } catch (Exception e){
            throw new IllegalArgumentException(e);
        }
        handle(decode, connection);
    }

    void unregister(Connection connection, String reason);

    void handleError(Connection connection, Throwable exception);