io.vertx.core.http.ServerWebSocket Maven / Gradle / Ivy
/*
* Copyright (c) 2011-2013 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.vertx.core.http;
import io.vertx.codegen.annotations.CacheReturn;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.annotations.Nullable;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
import io.vertx.core.buffer.Buffer;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.security.cert.X509Certificate;
/**
* Represents a server side WebSocket.
*
* Instances of this class are passed into a {@link io.vertx.core.http.HttpServer#websocketHandler} or provided
* when a WebSocket handshake is manually {@link HttpServerRequest#upgrade}ed.
*
* @author Tim Fox
*/
@VertxGen
public interface ServerWebSocket extends WebSocketBase {
@Override
ServerWebSocket exceptionHandler(Handler handler);
@Override
ServerWebSocket handler(Handler handler);
@Override
ServerWebSocket pause();
@Override
ServerWebSocket resume();
@Override
ServerWebSocket endHandler(Handler endHandler);
@Override
ServerWebSocket write(Buffer data);
@Override
ServerWebSocket setWriteQueueMaxSize(int maxSize);
@Override
ServerWebSocket drainHandler(Handler handler);
@Override
ServerWebSocket writeFrame(WebSocketFrame frame);
@Override
ServerWebSocket writeFinalTextFrame(String text);
@Override
ServerWebSocket writeFinalBinaryFrame(Buffer data);
@Override
ServerWebSocket writeBinaryMessage(Buffer data);
@Override
ServerWebSocket closeHandler(Handler handler);
@Override
ServerWebSocket frameHandler(Handler handler);
/*
* @return the WebSocket handshake URI. This is a relative URI.
*/
String uri();
/**
* @return the WebSocket handshake path.
*/
String path();
/**
* @return the WebSocket handshake query string.
*/
@Nullable
String query();
/**
* @return the headers in the WebSocket handshake
*/
@CacheReturn
MultiMap headers();
/**
* Reject the WebSocket.
*
* Calling this method from the websocket handler when it is first passed to you gives you the opportunity to reject
* the websocket, which will cause the websocket handshake to fail by returning
* a 404 response code.
*
* You might use this method, if for example you only want to accept WebSockets with a particular path.
*/
void reject();
/**
* @return an array of the peer certificates. Returns null if connection is
* not SSL.
* @throws javax.net.ssl.SSLPeerUnverifiedException SSL peer's identity has not been verified.
*/
@GenIgnore
X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException;
}