io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket Maven / Gradle / Ivy
package io.vertx.mutiny.ext.web.handler.sockjs;
import java.util.Map;
import java.util.stream.Collectors;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;
import io.smallrye.mutiny.vertx.TypeArg;
import io.vertx.codegen.annotations.Fluent;
import io.smallrye.common.annotation.CheckReturnValue;
import io.vertx.core.Future;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
/**
*
* You interact with SockJS clients through instances of SockJS socket.
*
* The API is very similar to {@link io.vertx.mutiny.core.http.WebSocket}.
* It implements both and
* so it can be used with
* {@link io.vertx.mutiny.core.streams.Pump} to pump data with flow control.
*
*
* NOTE: This class has been automatically generated from the {@link io.vertx.ext.web.handler.sockjs.SockJSSocket original} non Mutiny-ified interface using Vert.x codegen.
*/
@io.smallrye.mutiny.vertx.MutinyGen(io.vertx.ext.web.handler.sockjs.SockJSSocket.class)
public class SockJSSocket implements io.vertx.mutiny.core.streams.ReadStream, io.vertx.mutiny.core.streams.WriteStream {
public static final io.smallrye.mutiny.vertx.TypeArg __TYPE_ARG = new io.smallrye.mutiny.vertx.TypeArg<>( obj -> new SockJSSocket((io.vertx.ext.web.handler.sockjs.SockJSSocket) obj),
SockJSSocket::getDelegate
);
private final io.vertx.ext.web.handler.sockjs.SockJSSocket delegate;
public SockJSSocket(io.vertx.ext.web.handler.sockjs.SockJSSocket delegate) {
this.delegate = delegate;
}
public SockJSSocket(Object delegate) {
this.delegate = (io.vertx.ext.web.handler.sockjs.SockJSSocket)delegate;
}
/**
* Empty constructor used by CDI, do not use this constructor directly.
**/
SockJSSocket() {
this.delegate = null;
}
public io.vertx.ext.web.handler.sockjs.SockJSSocket getDelegate() {
return delegate;
}
static final io.smallrye.mutiny.vertx.TypeArg TYPE_ARG_0 = new TypeArg(o1 -> io.vertx.mutiny.core.buffer.Buffer.newInstance((io.vertx.core.buffer.Buffer)o1), o1 -> o1.getDelegate());
@Override
public String toString() {
return delegate.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SockJSSocket that = (SockJSSocket) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
private io.smallrye.mutiny.vertx.WriteStreamSubscriber subscriber;
@CheckReturnValue
public synchronized io.smallrye.mutiny.vertx.WriteStreamSubscriber toSubscriber() {
if (subscriber == null) {
java.util.function.Function conv = io.vertx.mutiny.core.buffer.Buffer::getDelegate;
subscriber = io.smallrye.mutiny.vertx.MutinyHelper.toSubscriber(getDelegate(), conv);
}
return subscriber;
}
@CheckReturnValue
public io.smallrye.mutiny.Uni end() {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(arg0 -> {
delegate.end(arg0);
});
}
public Void endAndAwait() {
return (Void) end().await().indefinitely();
}
public void endAndForget() {
end().subscribe().with(io.smallrye.mutiny.vertx.UniHelper.NOOP);
}
@CheckReturnValue
public io.smallrye.mutiny.Uni end(io.vertx.mutiny.core.buffer.Buffer data) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
delegate.end(data.getDelegate(), handler);
});
}
public Void endAndAwait(io.vertx.mutiny.core.buffer.Buffer data) {
return (Void) end(data).await().indefinitely();
}
public void endAndForget(io.vertx.mutiny.core.buffer.Buffer data) {
end(data).subscribe().with(io.smallrye.mutiny.vertx.UniHelper.NOOP);
}
public boolean writeQueueFull() {
boolean ret = delegate.writeQueueFull();
return ret;
}
public io.vertx.mutiny.core.streams.Pipe pipe() {
io.vertx.mutiny.core.streams.Pipe ret = io.vertx.mutiny.core.streams.Pipe.newInstance((io.vertx.core.streams.Pipe)delegate.pipe(), TYPE_ARG_0);
return ret;
}
@CheckReturnValue
public io.smallrye.mutiny.Uni pipeTo(io.vertx.mutiny.core.streams.WriteStream dst) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
delegate.pipeTo(dst.getDelegate(), handler);
});
}
public Void pipeToAndAwait(io.vertx.mutiny.core.streams.WriteStream dst) {
return (Void) pipeTo(dst).await().indefinitely();
}
public void pipeToAndForget(io.vertx.mutiny.core.streams.WriteStream dst) {
pipeTo(dst).subscribe().with(io.smallrye.mutiny.vertx.UniHelper.NOOP);
}
@Fluent
private io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket __exceptionHandler(Handler handler) {
delegate.exceptionHandler(handler);
return this;
}
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket exceptionHandler(java.util.function.Consumer handler) {
return __exceptionHandler(handler != null ? new io.smallrye.mutiny.vertx.DelegatingConsumerHandler(handler) : null);
}
@Fluent
private io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket __handler(Handler handler) {
delegate.handler(new io.smallrye.mutiny.vertx.DelegatingHandler<>(handler, event -> io.vertx.mutiny.core.buffer.Buffer.newInstance((io.vertx.core.buffer.Buffer)event)));
return this;
}
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket handler(java.util.function.Consumer handler) {
return __handler(handler != null ? new io.smallrye.mutiny.vertx.DelegatingConsumerHandler(handler) : null);
}
@Fluent
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket pause() {
delegate.pause();
return this;
}
@Fluent
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket resume() {
delegate.resume();
return this;
}
@Fluent
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket fetch(long amount) {
delegate.fetch(amount);
return this;
}
@Fluent
private io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket __endHandler(Handler endHandler) {
delegate.endHandler(endHandler);
return this;
}
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket endHandler(java.lang.Runnable endHandler) {
return __endHandler(ignored -> endHandler.run()
);
}
private io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket __closeHandler(Handler closeHandler) {
io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket ret = io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket.newInstance((io.vertx.ext.web.handler.sockjs.SockJSSocket)delegate.closeHandler(closeHandler));
return ret;
}
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket closeHandler(java.lang.Runnable closeHandler) {
return __closeHandler(ignored -> closeHandler.run()
);
}
@CheckReturnValue
public io.smallrye.mutiny.Uni write(String data) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
delegate.write(data, handler);
});
}
public Void writeAndAwait(String data) {
return (Void) write(data).await().indefinitely();
}
public void writeAndForget(String data) {
write(data).subscribe().with(io.smallrye.mutiny.vertx.UniHelper.NOOP);
}
@CheckReturnValue
public io.smallrye.mutiny.Uni write(io.vertx.mutiny.core.buffer.Buffer data) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
delegate.write(data.getDelegate(), handler);
});
}
public Void writeAndAwait(io.vertx.mutiny.core.buffer.Buffer data) {
return (Void) write(data).await().indefinitely();
}
public void writeAndForget(io.vertx.mutiny.core.buffer.Buffer data) {
write(data).subscribe().with(io.smallrye.mutiny.vertx.UniHelper.NOOP);
}
@Fluent
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket setWriteQueueMaxSize(int maxSize) {
delegate.setWriteQueueMaxSize(maxSize);
return this;
}
@Fluent
private io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket __drainHandler(Handler handler) {
delegate.drainHandler(handler);
return this;
}
public io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket drainHandler(java.lang.Runnable handler) {
return __drainHandler(ignored -> handler.run()
);
}
/**
* @return the writeHandlerID
or null
if writeHandler
registration is disabled in {@link io.vertx.ext.web.handler.sockjs.SockJSHandlerOptions}
*/
public String writeHandlerID() {
String ret = delegate.writeHandlerID();
return ret;
}
/**
*/
public void close() {
delegate.close();
}
/**
* @param statusCode
* @param reason
*/
public void close(int statusCode, String reason) {
delegate.close(statusCode, reason);
}
/**
* @return
*/
public io.vertx.mutiny.core.net.SocketAddress remoteAddress() {
io.vertx.mutiny.core.net.SocketAddress ret = io.vertx.mutiny.core.net.SocketAddress.newInstance((io.vertx.core.net.SocketAddress)delegate.remoteAddress());
return ret;
}
/**
* @return
*/
public io.vertx.mutiny.core.net.SocketAddress localAddress() {
io.vertx.mutiny.core.net.SocketAddress ret = io.vertx.mutiny.core.net.SocketAddress.newInstance((io.vertx.core.net.SocketAddress)delegate.localAddress());
return ret;
}
/**
* @return
*/
public io.vertx.mutiny.core.MultiMap headers() {
io.vertx.mutiny.core.MultiMap ret = io.vertx.mutiny.core.MultiMap.newInstance((io.vertx.core.MultiMap)delegate.headers());
return ret;
}
/**
* @return
*/
public String uri() {
String ret = delegate.uri();
return ret;
}
/**
* @return the Vert.x-Web RoutingContext corresponding to this socket
*/
public io.vertx.mutiny.ext.web.RoutingContext routingContext() {
io.vertx.mutiny.ext.web.RoutingContext ret = io.vertx.mutiny.ext.web.RoutingContext.newInstance((io.vertx.ext.web.RoutingContext)delegate.routingContext());
return ret;
}
/**
* @return the Vert.x-Web session corresponding to this socket
*/
public io.vertx.mutiny.ext.web.Session webSession() {
io.vertx.mutiny.ext.web.Session ret = io.vertx.mutiny.ext.web.Session.newInstance((io.vertx.ext.web.Session)delegate.webSession());
return ret;
}
/**
* @return the Vert.x-Web user corresponding to this socket
*/
public io.vertx.mutiny.ext.auth.User webUser() {
io.vertx.mutiny.ext.auth.User ret = io.vertx.mutiny.ext.auth.User.newInstance((io.vertx.ext.auth.User)delegate.webUser());
return ret;
}
private Multi multi;
@CheckReturnValue
public synchronized Multi toMulti() {
if (multi == null) {
java.util.function.Function conv = io.vertx.mutiny.core.buffer.Buffer::newInstance;
multi = io.smallrye.mutiny.vertx.MultiHelper.toMulti(delegate, conv); }
return multi;
}
public java.lang.Iterable toBlockingIterable() {
return toMulti().subscribe().asIterable();
}
public java.util.stream.Stream toBlockingStream() {
return toMulti().subscribe().asStream();
}
public static SockJSSocket newInstance(io.vertx.ext.web.handler.sockjs.SockJSSocket arg) {
return arg != null ? new SockJSSocket(arg) : null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy