You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
2.5 KiB
113 lines
2.5 KiB
7 years ago
|
/**
|
||
6 years ago
|
* Copyright (c) 2012-2019 Nikita Koksharov
|
||
7 years ago
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
package com.fr.third.socketio;
|
||
|
|
||
|
import java.net.SocketAddress;
|
||
|
import java.util.Set;
|
||
|
import java.util.UUID;
|
||
|
|
||
|
import com.fr.third.socketio.protocol.Packet;
|
||
|
import com.fr.third.socketio.store.Store;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Fully thread-safe.
|
||
|
*
|
||
|
*/
|
||
|
public interface SocketIOClient extends ClientOperations, Store {
|
||
|
|
||
|
/**
|
||
|
* Handshake data used during client connection
|
||
|
*
|
||
|
* @return HandshakeData
|
||
|
*/
|
||
|
HandshakeData getHandshakeData();
|
||
|
|
||
|
/**
|
||
|
* Current client transport protocol
|
||
|
*
|
||
|
* @return transport protocol
|
||
|
*/
|
||
|
Transport getTransport();
|
||
|
|
||
|
/**
|
||
|
* Send event with ack callback
|
||
|
*
|
||
|
* @param name - event name
|
||
|
* @param data - event data
|
||
|
* @param ackCallback - ack callback
|
||
|
*/
|
||
|
void sendEvent(String name, AckCallback<?> ackCallback, Object ... data);
|
||
|
|
||
|
/**
|
||
|
* Send packet with ack callback
|
||
|
*
|
||
|
* @param packet - packet to send
|
||
|
* @param ackCallback - ack callback
|
||
|
*/
|
||
|
void send(Packet packet, AckCallback<?> ackCallback);
|
||
|
|
||
|
/**
|
||
|
* Client namespace
|
||
|
*
|
||
|
* @return - namespace
|
||
|
*/
|
||
|
SocketIONamespace getNamespace();
|
||
|
|
||
|
/**
|
||
|
* Client session id, uses {@link UUID} object
|
||
|
*
|
||
|
* @return - session id
|
||
|
*/
|
||
|
UUID getSessionId();
|
||
|
|
||
|
/**
|
||
|
* Get client remote address
|
||
|
*
|
||
|
* @return remote address
|
||
|
*/
|
||
|
SocketAddress getRemoteAddress();
|
||
|
|
||
|
/**
|
||
|
* Check is underlying channel open
|
||
|
*
|
||
|
* @return <code>true</code> if channel open, otherwise <code>false</code>
|
||
|
*/
|
||
|
boolean isChannelOpen();
|
||
|
|
||
|
/**
|
||
|
* Join client to room
|
||
|
*
|
||
|
* @param room - name of room
|
||
|
*/
|
||
|
void joinRoom(String room);
|
||
|
|
||
|
/**
|
||
|
* Join client to room
|
||
|
*
|
||
|
* @param room - name of room
|
||
|
*/
|
||
|
void leaveRoom(String room);
|
||
|
|
||
|
/**
|
||
|
* Get all rooms a client is joined in.
|
||
|
*
|
||
|
* @return name of rooms
|
||
|
*/
|
||
|
Set<String> getAllRooms();
|
||
|
|
||
|
}
|