com.github.zhengframework.web.WebSocketEndpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zheng-web Show documentation
Show all versions of zheng-web Show documentation
zheng framework module: web server
/*
* Copyright (C) 2017 Jonas Zeiger
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.github.zhengframework.web;
import java.io.IOException;
import javax.websocket.CloseReason;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
@ServerEndpoint("/ws")
public abstract class WebSocketEndpoint {
@OnOpen
public abstract void connect(Session session) throws IOException;
@OnMessage
public abstract void message(String message, Session session);
@OnMessage
public abstract void message(byte[] data, boolean done, Session session);
@OnError
public abstract void error(Throwable exception, Session session);
@OnClose
public abstract void close(CloseReason closeReason, Session session);
}