
io.jsync.http.ServerWebSocket Maven / Gradle / Ivy
Show all versions of jsync.io Show documentation
/*
* 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.jsync.http;
import io.jsync.MultiMap;
/**
* Represents a server side WebSocket that is passed into a the websocketHandler of an {@link HttpServer}
* Instances of this class are not thread-safe
*
* @author Tim Fox
*/
public interface ServerWebSocket extends WebSocketBase {
/*
* The uri the websocket handshake occurred at
*/
String uri();
/**
* The path the websocket is attempting to connect at
*/
String path();
/**
* The query string passed on the websocket uri
*/
String query();
/**
* A map of all headers in the request to upgrade to websocket
*/
MultiMap headers();
/**
* Reject the WebSocket
* Calling this method from the websocketHandler 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.
*/
ServerWebSocket reject();
}