io.contek.invoker.bybitlinear.api.websocket.WebSocketApi Maven / Gradle / Ivy
package io.contek.invoker.bybitlinear.api.websocket;
import com.google.common.collect.ImmutableList;
import io.contek.invoker.commons.actor.IActor;
import io.contek.invoker.commons.actor.ratelimit.TypedPermitRequest;
import io.contek.invoker.commons.websocket.*;
import io.contek.invoker.security.ICredential;
import javax.annotation.concurrent.ThreadSafe;
@ThreadSafe
public abstract class WebSocketApi extends BaseWebSocketApi {
private final WebSocketContext context;
protected WebSocketApi(IActor actor, WebSocketContext context) {
super(
actor,
new WebSocketMessageParser(),
new WebSocketAuthenticator(actor.getCredential(), actor.getClock()),
IWebSocketLiveKeeper.noOp());
this.context = context;
}
@Override
protected final ImmutableList getRequiredQuotas() {
return ImmutableList.of();
}
@Override
protected final WebSocketCall createCall(ICredential credential) {
return WebSocketCall.fromUrl(context.getBaseUrl() + getUrlSuffix());
}
@Override
protected final void checkErrorMessage(AnyWebSocketMessage message)
throws WebSocketRuntimeException {}
protected abstract String getUrlSuffix();
}