Skip to content

Commit

Permalink
feat: changing port number
Browse files Browse the repository at this point in the history
  • Loading branch information
f-steel committed Sep 3, 2024
1 parent ab05328 commit 746d10c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"dev:spotlight": "spotlight-sidecar",
"dev:next": "next dev",
"dev": "run-p dev:*",
"dev-colab": "node server.js && HOST=0.0.0.0 npx y-websocket",
"dev-colab": "node server.js",
"build": "next build",
"build-with-migrate": "npm run db:migrate && next build",
"start": "NODE_ENV=production node server.js && HOST=0.0.0.0 npx y-websocket",
"start": "NODE_ENV=production node server.js",
"build-stats": "cross-env ANALYZE=true npm run build",
"clean": "rimraf .next .swc out coverage",
"lint": "next lint",
Expand Down
21 changes: 10 additions & 11 deletions src/_components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ const Editor = React.memo(function EditorC({
id={colabID}
// @ts-ignore
providerFactory={(id, yjsDocMap) => {
const protocol =
window.location.protocol === 'https:' ? 'wss:' : 'ws:';
let doc = yjsDocMap.get(id);
if (!doc) {
doc = new Y.Doc();
Expand All @@ -265,16 +263,17 @@ const Editor = React.memo(function EditorC({
doc.load();
}

// web socket provider
const url = new URL(window.location.href);
const wsUrl =
window.location.protocol === 'https'
? 'wss://socket.wetype.net'
: `${protocol}//${url.hostname}:1234/socket.io`;
const protocol =
window.location.protocol === 'https:' ? 'wss:' : 'ws:';

const provider = new WebsocketProvider(wsUrl, id, doc, {
connect: true,
});
const provider = new WebsocketProvider(
`${protocol}//${window.location.host}/socket.io`,
id,
doc,
{
connect: true,
}
);

provider.on('status', (event: { status: string }) => {
// logger.debug(event.status);
Expand Down

0 comments on commit 746d10c

Please sign in to comment.