Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
The MIT License Copyright (c) 2010 Tad Glines Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package com.glines.socketio.client.common;
public interface SocketIOConnection {
	interface Factory {
				String hostshort port);
	}
		public abstract void onConnect();
		public abstract void onDisconnect(DisconnectReason reasonString errorMessage);
		public abstract void onMessage(int messageTypeString message);
	}

Initiate a connection attempt. If the connection succeeds, then the onConnect will be called. If the connection attempt fails, then onDisonnect will be called.

Throws:
java.lang.IllegalStateException if the socket is not CLOSED.
	void connect();

Forcefully disconnect the connection, discarding any unsent messages. This does nothing if the connection is already CLOSED. This will abort an orderly close if one was initiated.
	void disconnect();

Initiate an orderly close of the connection.

Throws:
java.lang.IllegalStateException if the socket is not CONNECTED.
	void close();

Return the current socket connection state.

Returns:
Send a message.

Parameters:
message
Throws:
java.lang.IllegalStateException if the socket is not CONNECTED.
	void sendMessage(String messagethrows SocketIOException;

Send a message. With a default priority of 0.

Parameters:
message
Throws:
java.lang.IllegalStateException if the socket is not CONNECTED.
SocketIOMessageParserException if the message type parser encode() failed.
	void sendMessage(int messageTypeString messagethrows SocketIOException;
New to GrepCode? Check out our FAQ X