修复问题

This commit is contained in:
ZhuoQinghui 2024-09-27 15:01:22 +08:00
parent 13c68f8474
commit 9870300952
2 changed files with 6 additions and 2 deletions

View File

@ -4,6 +4,9 @@ WORKDIR /app
COPY . .
RUN npm config set registry https://registry.npmmirror.com/
RUN npm install
EXPOSE 3000
CMD ["npm", "start"]
CMD ["node", "server.js"]

View File

@ -12,7 +12,8 @@
<div id="messageContainer"></div>
<script>
const ws = new WebSocket('ws://localhost:3000');
const port = !window.location.port ? '' : `:${window.location.port}`;
const ws = new WebSocket(`ws://${window.location.hostname}${port}`);
const messageContainer = document.getElementById('messageContainer');
ws.onmessage = function(event) {