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

tech.greenfield.vertx.irked.WebSocketUpgradeRequestWrapper Maven / Gradle / Ivy

There is a newer version: 4.5.10
Show newest version
package tech.greenfield.vertx.irked;


import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
import tech.greenfield.vertx.irked.websocket.WebSocketConnection;
import tech.greenfield.vertx.irked.websocket.WebSocketMessage;

public class WebSocketUpgradeRequestWrapper extends RequestWrapper {

	private Handler msghandler;

	public WebSocketUpgradeRequestWrapper(Handler handler, RequestWrapper parent) {
		super(parent);
		this.msghandler = handler;
	}

	@Override
	public void handle(RoutingContext r) {
		Request req = wrapper.apply(r);
		if (req.needUpgrade("websocket"))
			new WebSocketConnection(req, msghandler);
		else
			req.next();
	}
	
	@Override
	public String toString() {
		return "WS=>" + wrapper + "." + msghandler;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy