package com.rf.psychological.socket;


import org.java_websocket.client.WebSocketClient;
import org.java_websocket.drafts.Draft_6455;
import org.java_websocket.handshake.ServerHandshake;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.URI;

public class MyClient extends WebSocketClient {

    private final static Logger logger = LoggerFactory.getLogger(MyClient.class);
    public MyClient(String serverUri) {
        super(URI.create(serverUri),new Draft_6455(),null,0);
    }

    @Override
    public void onOpen(ServerHandshake handshakedata) {
        logger.info("MyClient","-------------onOpen");
    }

    @Override
    public void onMessage(String message) {
        logger.info("MyClient","------------onMessage");
        logger.info("MyClient","------------"+message);
    }

    @Override
    public void onClose(int code, String reason, boolean remote) {
        logger.info("MyClient","onClose");
    }

    @Override
    public void onError(Exception ex) {
        logger.info("MyClient","-------------------onError");
        logger.info("MyClient","-------------------"+ex.getMessage());
    }

}
