Skip to content

Commit

Permalink
fix: bitget spot and futures websocket handshake error
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptochassis committed Aug 17, 2023
1 parent 4af5c66 commit 3f597cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class ExecutionManagementServiceBitgetBase : public ExecutionManagementService {
public:
ExecutionManagementServiceBitgetBase(std::function<void(Event&, Queue<Event>*)> eventHandler, SessionOptions sessionOptions, SessionConfigs sessionConfigs,
ServiceContextPtr serviceContextPtr)
: ExecutionManagementService(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {}
: ExecutionManagementService(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {
this->hostHttpHeaderValueIgnorePort = true;
}
virtual ~ExecutionManagementServiceBitgetBase() {}
#ifndef CCAPI_EXPOSE_INTERNAL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class MarketDataServiceBitgetBase : public MarketDataService {
public:
MarketDataServiceBitgetBase(std::function<void(Event&, Queue<Event>*)> eventHandler, SessionOptions sessionOptions, SessionConfigs sessionConfigs,
std::shared_ptr<ServiceContext> serviceContextPtr)
: MarketDataService(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {}
: MarketDataService(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {
this->hostHttpHeaderValueIgnorePort = true;
}
virtual ~MarketDataServiceBitgetBase() {}
#ifndef CCAPI_EXPOSE_INTERNAL

Expand Down
4 changes: 3 additions & 1 deletion include/ccapi_cpp/service/ccapi_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,8 @@ class Service : public std::enable_shared_from_this<Service> {
}
CCAPI_LOGGER_TRACE("connected");
CCAPI_LOGGER_TRACE("ep.port() = " + std::to_string(ep.port()));
wsConnectionPtr->hostHttpHeaderValue = wsConnectionPtr->host + ':' + std::to_string(ep.port());
wsConnectionPtr->hostHttpHeaderValue =
this->hostHttpHeaderValueIgnorePort ? wsConnectionPtr->host : wsConnectionPtr->host + ':' + std::to_string(ep.port());
CCAPI_LOGGER_TRACE("wsConnectionPtr->hostHttpHeaderValue = " + wsConnectionPtr->hostHttpHeaderValue);
beast::websocket::stream<beast::ssl_stream<beast::tcp_stream>>& stream = *wsConnectionPtr->streamPtr;
beast::get_lowest_layer(stream).socket().set_option(tcp::no_delay(true));
Expand Down Expand Up @@ -1711,6 +1712,7 @@ class Service : public std::enable_shared_from_this<Service> {
}
virtual void onTextMessage(std::shared_ptr<WsConnection> wsConnectionPtr, boost::beast::string_view textMessage, const TimePoint& timeReceived) {}
#endif
bool hostHttpHeaderValueIgnorePort{};
std::string apiKeyName;
std::string apiSecretName;
std::string exchangeName;
Expand Down

0 comments on commit 3f597cc

Please sign in to comment.