Repository: next.js
Issue: Slate-yjs - Firefox can’t establish a connection to the server at ws://127.0.0.1:1234/.
Labels: bug

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Hi,
there is an issue using slate-yjs in next@13.4.6.
When I try to connect with HocusPocusProvider to my hocus-pocus server the socket connects and disconnects immediately. The connection reach the server but somehow the socket hangs up.

The problem is that for the same code, it's working without any problem with vite but not on nextjs.
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

_No response_

### Link to the code that reproduces this issue or a replay of the bug

https://codesandbox.io/p/github/pierrelouisdelx/slate-yjs-next/main?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522panelType%2522%253A%2522TABS%2522%252C%2522id%2522%253A%2522clj6visrd000b3b6239wpwhoy%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522panelType%2522%253A%2522TABS%2522%252C%2522id%2522%253A%2522clj6visrd000d3b620rccr33b%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clj6visrd000b3b6239wpwhoy%2522%253A%257B%2522id%2522%253A%2522clj6visrd000b3b6239wpwhoy%2522%252C%2522activeTabId%2522%253A%2522clj6vnwau00ha3b62y8gh3hl2%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clj6visrd000a3b62w5cdh252%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252FREADME.md%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fpackage.json%2522%252C%2522id%2522%253A%2522clj6vnwau00ha3b62y8gh3hl2%2522%252C%2522mode%2522%253A%2522temporary%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%257D%252C%2522clj6visrd000d3b620rccr33b%2522%253A%257B%2522id%2522%253A%2522clj6visrd000d3b620rccr33b%2522%252C%2522activeTabId%2522%253A%2522clj6vnj6l008r3b628ulv16z0%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clj6vnj6l008r3b628ulv16z0%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%252C%257B%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A3000%252C%2522id%2522%253A%2522clj6vpvr400cm3b62q1y4mx1d%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522path%2522%253A%2522%252F%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

### To Reproduce

```sh
import { HocuspocusProvider } from '@hocuspocus/provider'
import React, {
    useEffect,
    useMemo,
   useState
} from 'react'

const [connected, setConnected] = useState(false)

const provider = useMemo(
        () =>
            new HocuspocusProvider({
                url: HOCUSPOCUS_ENDPOINT,
                name: 'slate-yjs-demo',
                onConnect: () => setConnected(true),
                onDisconnect: () => setConnected(false),
            }),
        []
    )

    useEffect(() => {
        if (typeof window !== 'undefined') {
            provider.connect()
        }
        console.log(provider)
    }, [])

### Describe the Bug

Here is the error:
Firefox can’t establish a connection to the server at ws://127.0.0.1:1234/.
I've got the same error on chrome
error Error: Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.

Here is the provider object after I've tried to connect:
{
  "callbacks": {
    "open": [
      null
    ],
    "message": [
      null
    ],
    "outgoingMessage": [
      null
    ],
    "synced": [
      null
    ],
    "destroy": [
      null
    ],
    "awarenessUpdate": [
      null
    ],
    "awarenessChange": [
      null
    ],
    "stateless": [
      null
    ],
    "authenticated": [
      null
    ],
    "authenticationFailed": [
      null
    ]
  },
  "configuration": {
    "name": "slate-yjs-demo",
    "document": {
      "_observers": {},
      "gc": true,
      "clientID": 3270281034,
      "guid": "db39bca1-1e67-4b69-aa2e-4fbf5d5e2acc",
      "collectionid": null,
      "share": {},
      "store": {
        "clients": {},
        "pendingStructs": null,
        "pendingDs": null
      },
      "_transaction": null,
      "_transactionCleanups": [],
      "subdocs": {},
      "_item": null,
      "shouldLoad": true,
      "autoLoad": false,
      "meta": null,
      "isLoaded": false,
      "isSynced": false,
      "whenLoaded": {},
      "whenSynced": {}
    },
    "awareness": {
      "_observers": {},
      "doc": {
        "_observers": {},
        "gc": true,
        "clientID": 3270281034,
        "guid": "db39bca1-1e67-4b69-aa2e-4fbf5d5e2acc",
        "collectionid": null,
        "share": {},
        "store": {
          "clients": {},
          "pendingStructs": null,
          "pendingDs": null
        },
        "_transaction": null,
        "_transactionCleanups": [],
        "subdocs": {},
        "_item": null,
        "shouldLoad": true,
        "autoLoad": false,
        "meta": null,
        "isLoaded": false,
        "isSynced": false,
        "whenLoaded": {},
        "whenSynced": {}
      },
      "clientID": 3270281034,
      "states": {},
      "meta": {},
      "_checkInterval": 579
    },
    "token": null,
    "parameters": {},
    "broadcast": true,
    "forceSyncInterval": false,
    "quiet": false,
    "websocketProvider": {
      "callbacks": {
        "open": [
          null,
          null,
          null,
          null
        ],
        "connect": [
          null,
          null,
          null
        ],
        "message": [
          null,
          null,
          null
        ],
        "outgoingMessage": [
          null
        ],
        "status": [
          null,
          null,
          null
        ],
        "disconnect": [
          null,
          null,
          null
        ],
        "close": [
          null,
          null,
          null,
          null,
          null
        ],
        "destroy": [
          null,
          null,
          null
        ],
        "awarenessUpdate": [
          null
        ],
        "awarenessChange": [
          null
        ]
      },
      "configuration": {
        "url": "ws://127.0.0.1:1234",
        "connect": true,
        "broadcast": true,
        "forceSyncInterval": false,
        "messageReconnectTimeout": 30000,
        "delay": 1000,
        "initialDelay": 0,
        "factor": 2,
        "maxAttempts": 0,
        "minDelay": 1000,
        "maxDelay": 30000,
        "jitter": true,
        "timeout": 0,
        "quiet": false
      },
      "subscribedToBroadcastChannel": false,
      "webSocket": {},
      "shouldConnect": true,
      "status": "connecting",
      "lastMessageReceived": 0,
      "intervals": {
        "forceSync": null,
        "connectionChecker": 578
      },
      "connectionAttempt": {},
      "receivedOnOpenPayload": {
        "isTrusted": true
      },
      "receivedOnStatusPayload": {
        "status": "connecting"
      }
    },
    "url": "ws://127.0.0.1:1234"
  },
  "subscribedToBroadcastChannel": false,
  "isSynced": false,
  "unsyncedChanges": 0,
  "status": "connecting",
  "isAuthenticated": false,
  "intervals": {
    "forceSync": null
  },
  "isConnected": true
}


### Expected Behavior

Connect to the hocus hocus server

### Which browser are you using? (if relevant)

Firefox 114.0.1 (64-bit), Chrome 114.0.5735.133 (Official Build) 

### How are you deploying your application? (if relevant)

next dev