All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.docshare.boot.MyWebSocketHandler Maven / Gradle / Ivy

Go to download

YangMVC is an efficient, fast, convenient, easy to learn, easy to use MVC framework and ORM framework. Use yangmvc-boot is something like spring-boot . Call ServerMain.main(args); in your main method can start a server.

There is a newer version: 2023.06.19
Show newest version
package org.docshare.boot;

import java.util.ArrayList;

import org.docshare.log.Log;
import org.eclipse.jetty.websocket.server.WebSocketHandler;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;

public class MyWebSocketHandler extends WebSocketHandler {
	static WebSocketServletFactory fac;
	@Override
	public void configure(WebSocketServletFactory factory) {
		 // 设置超时
        //factory.getPolicy().setIdleTimeout(10000);
        // 注册
        //factory.register(DefaultWebSocketListener.class);
        
       
        for(Class c: arrayList){
			Log.i("register WebSocket Handler2: "+c.getName());
        	factory.register(c);
        	
        }
        arrayList.clear();
        
        fac = factory;
        
        //factory.register(MyWebSocketListener.class);
	}
	static ArrayList> arrayList=new ArrayList<>();
	public static void register(Class clazz){
		
		if(fac == null){
			arrayList.add(clazz);
		}
		else{
			Log.i("register WebSocket Handler "+clazz.getName());
			fac.register(clazz);
		}
	}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy