Skip to content

Commit

Permalink
Merge pull request #57 from softeerbootcamp4th/fix-crypto
Browse files Browse the repository at this point in the history
[fix] common package tsup 번들 제외되어 문제되는 socket 관련 라이브러리 -> 번들링 포함에 명시
  • Loading branch information
nim-od authored Aug 14, 2024
2 parents ba21b90 + 00bc00d commit 9843dc6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 97 deletions.
3 changes: 1 addition & 2 deletions packages/common/src/utils/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export default class Socket {
const stompClient = new Client({
webSocketFactory: () => new SockJS(`${url}/ws`),
reconnectDelay: 5000, // Reconnect if the connection drops
// heartbeatIncoming: 4000, // Check for server heartbeat
// heartbeatOutgoing: 4000, // Send a heartbeat
});
this.client = stompClient;
return stompClient;
Expand Down Expand Up @@ -62,6 +60,7 @@ export default class Socket {
}) {
const subscription = this.client.subscribe(destination, (message: IMessage) => {
const messageId = message.headers['message-id'];

callback(messageId, message);
});
this.subscriptions.set(destination, subscription);
Expand Down
2 changes: 2 additions & 0 deletions packages/common/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ export default defineConfig({
loader: {
'.svg': 'file',
},
noExternal: ['sockjs-client', '@stomp/stompjs'],
platform: 'browser',
});
2 changes: 1 addition & 1 deletion packages/user/src/components/event/chatting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChatList, ChatProps } from '@softeer/common/components';
import { CHAT_SOCKET_ENDPOINTS } from '@softeer/common/constants';
import { IMessage } from '@stomp/stompjs';
import { useEffect, useState } from 'react';
import socketClient from 'src/services/socket/index.ts';
import socketClient from 'src/services/socket.ts';
import Chat from './Chat.tsx';
import ChatInputArea from './inputArea/index.tsx';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Socket } from '@softeer/common/utils';
import { SOCKET_BASE_URL } from 'src/constants/environments.ts';
import Socket from 'src/services/socket/socket.ts';

const socketClient = new Socket(SOCKET_BASE_URL);
export default socketClient;
93 changes: 0 additions & 93 deletions packages/user/src/services/socket/socket.ts

This file was deleted.

0 comments on commit 9843dc6

Please sign in to comment.