|
|
|
@ -38,6 +38,7 @@ import java.util.Collection;
|
|
|
|
|
import java.util.UUID; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
|
import io.netty.util.concurrent.GenericFutureListener; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
@ -125,12 +126,37 @@ public class SocketIOServer implements ClientListeners {
|
|
|
|
|
startAsync().syncUninterruptibly(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void start(GenericFutureListener<? extends Future<? super Void>> listener) { |
|
|
|
|
startAsync(listener).syncUninterruptibly(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Start server asynchronously |
|
|
|
|
* |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
public Future<Void> startAsync() { |
|
|
|
|
return startAsync(new FutureListener<Void>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void operationComplete(Future<Void> future) throws Exception { |
|
|
|
|
|
|
|
|
|
if (future.isSuccess()) { |
|
|
|
|
log.info("SocketIO server started at port: {}", configCopy.getPort()); |
|
|
|
|
} else { |
|
|
|
|
log.error("SocketIO server start failed at port: {}!", configCopy.getPort()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Start server asynchronously |
|
|
|
|
* |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
public Future<Void> startAsync(GenericFutureListener<? extends Future<? super Void>> listener) { |
|
|
|
|
|
|
|
|
|
log.info("Session store / pubsub factory used: {}", configCopy.getStoreFactory()); |
|
|
|
|
initGroups(); |
|
|
|
|
|
|
|
|
@ -152,16 +178,7 @@ public class SocketIOServer implements ClientListeners {
|
|
|
|
|
addr = new InetSocketAddress(configCopy.getHostname(), configCopy.getPort()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return b.bind(addr).addListener(new FutureListener<Void>() { |
|
|
|
|
@Override |
|
|
|
|
public void operationComplete(Future<Void> future) throws Exception { |
|
|
|
|
if (future.isSuccess()) { |
|
|
|
|
log.info("SocketIO server started at port: {}", configCopy.getPort()); |
|
|
|
|
} else { |
|
|
|
|
log.error("SocketIO server start failed at port: {}!", configCopy.getPort()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return b.bind(addr).addListener(listener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void applyConnectionOptions(ServerBootstrap bootstrap) { |
|
|
|
@ -274,3 +291,4 @@ public class SocketIOServer implements ClientListeners {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|