Skip to content

Commit

Permalink
Fix/build UI (#255)
Browse files Browse the repository at this point in the history
* fix: build ui common

* fix: add log

* fix: add log
  • Loading branch information
quangdz1704 authored May 2, 2024
1 parent b90d217 commit fc62d99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/oraidex-common-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oraichain/oraidex-common-ui",
"version": "1.0.15",
"version": "1.0.16",
"files": [
"dist/"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export const useChartSocket = ({ currentPair, period, socketConfig }) => {
const { retryOnError = true, reconnectAttempts, reconnectInterval, wsUrl: socketUrl } = socketConfig || {};

const { lastJsonMessage, sendJsonMessage } = useWebSocket<LastJsonMessageType>(socketUrl || WS_URL, {
onOpen: () => {},
onOpen: () => {
console.info("useChartSocket: connect WebSocket - ", socketUrl);
},
onClose: () => {
console.info("useChartSocket: WebSocket connection closed.");
},
Expand Down Expand Up @@ -52,6 +54,12 @@ export const useChartSocket = ({ currentPair, period, socketConfig }) => {
setPairActive(currentPair);
}

console.info("SUBSCRIBE", {
id: 1,
method: "SUBSCRIBE",
params: [`${currentPair.info}@${period}`]
});

sendJsonMessage({
id: 1,
method: "SUBSCRIBE",
Expand All @@ -65,8 +73,9 @@ export const useChartSocket = ({ currentPair, period, socketConfig }) => {
const { data, stream } = lastJsonMessage || {};

// TODO: check event type
// if (stream === `${currentPair.info}@${period}`) {
if (stream !== `Pong`) {
if (stream === `${currentPair.info}@${period}`) {
// if (stream !== `Pong`) {
// console.info("Data stream: ", data);
setData(data);
handleTradeEvent(data);
}
Expand Down

0 comments on commit fc62d99

Please sign in to comment.