Minor fixes in websockets.ts
This commit is contained in:
parent
a5e1d0cd79
commit
237331c67f
@ -26,7 +26,6 @@ export async function initWebsocket(url: string) {
|
||||
(async () => {
|
||||
if (typeof msgData === 'string') {
|
||||
try {
|
||||
const feeRate = 0.0001;
|
||||
const parsedMessage = JSON.parse(msgData);
|
||||
const services = await Services.getInstance();
|
||||
switch (parsedMessage.flag) {
|
||||
@ -65,7 +64,7 @@ export function sendMessage(flag: AnkFlag, message: string): void {
|
||||
flag: flag,
|
||||
content: message,
|
||||
};
|
||||
console.log('Sending message:', JSON.stringify(networkMessage));
|
||||
console.log('Sending message of type:', flag);
|
||||
ws.send(JSON.stringify(networkMessage));
|
||||
} else {
|
||||
console.error('WebSocket is not open. ReadyState:', ws.readyState);
|
||||
@ -77,11 +76,6 @@ export function getUrl(): string {
|
||||
return ws.url;
|
||||
}
|
||||
|
||||
export function sendNormalMessage(message: string) {
|
||||
ws.send(message);
|
||||
console.log('Sending message:', JSON.stringify(message));
|
||||
}
|
||||
|
||||
// Method to close the WebSocket connection
|
||||
export function close(): void {
|
||||
ws.close();
|
||||
|
Loading…
x
Reference in New Issue
Block a user