trigger transport event upon its creation
This commit is contained in:
@@ -255,13 +255,18 @@ public class Socket extends Emitter {
|
|||||||
opts.policyPort = this.policyPort;
|
opts.policyPort = this.policyPort;
|
||||||
opts.socket = this;
|
opts.socket = this;
|
||||||
|
|
||||||
|
Transport transport;
|
||||||
if (WebSocket.NAME.equals(name)) {
|
if (WebSocket.NAME.equals(name)) {
|
||||||
return new WebSocket(opts);
|
transport = new WebSocket(opts);
|
||||||
} else if (Polling.NAME.equals(name)) {
|
} else if (Polling.NAME.equals(name)) {
|
||||||
return new PollingXHR(opts);
|
transport = new PollingXHR(opts);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException();
|
this.emit(EVENT_TRANSPORT, transport);
|
||||||
|
|
||||||
|
return transport;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTransport(Transport transport) {
|
private void setTransport(Transport transport) {
|
||||||
@@ -275,8 +280,6 @@ public class Socket extends Emitter {
|
|||||||
|
|
||||||
this.transport = transport;
|
this.transport = transport;
|
||||||
|
|
||||||
self.emit(EVENT_TRANSPORT, transport);
|
|
||||||
|
|
||||||
transport.on(Transport.EVENT_DRAIN, new Listener() {
|
transport.on(Transport.EVENT_DRAIN, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... args) {
|
public void call(Object... args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user