alamorre / nextjs-websocket

19 stars 1 forks source link

No export named Websocket (should import WebSocket instead); Socket URL doesn't work #1

Open dancherb opened 3 years ago

dancherb commented 3 years ago

Thanks for this package. A couple quick ones:

  1. The import Websocket in the readme.md looks like it should be WebSocket
  2. Before next.js, the URL I passed to the WebSocket component was:
const devMode = !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
const url = devMode ? 'ws://localhost:3000' : 'wss://www.mywebsite.com'

This works when running locally, but doesn't seem to work when deployed - any ideas? Thanks!

syedmahmad commented 3 years ago

I am also facing the same issue. There is export capitalisation issue. It should be import { WebSocket } from 'nextjs-websocket'; Instead import { Websocket } from 'nextjs-websocket'; Otherwise you may face following issue. image