Following the Usage Tutorial #166
-
Hello! First off, I love your work. I honestly believe this is the future. That said, I'm having troubles getting past basic deployment. The Usage tutorial in the readme shows a straight up geckos server (no express or anything else, just the sockets). This is exactly what I need! My site is hosted statically on Firebase and I want to keep it there. The tutorial works locally, I love it! But I've had no luck getting it to work in production. I've tried Docker, DigitalOcean, and GAE, all to no avail. So my question is: Have you ever been able to run a geckos.io server without serving HTML? And actually connect to it from another domain? Any advice you could spare will be appreciated <3 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I found the solution! Running on DigitalOcean, but this is reproducable in any Linux server environment.
I tried to make this as clear as possible. @yandeu if you see any mistakes or have suggestions, please lmk and I'll fix it. |
Beta Was this translation helpful? Give feedback.
-
for reference, my code look summ like this: import geckos from '@geckos.io/server'
const io = geckos({cors: {allowAuthorization: true}})
io.onConnection(channel => {
console.log(`new connection! (${channel.id})`)
channel.onDisconnect(() => console.log(`bye felicia! (${channel.id})`))
io.emit('msg', `new friend: ${channel.id}`)
channel.emit('msg', 'hi')
})
const port = process.env.PORT || 8081
io.listen(port) the |
Beta Was this translation helpful? Give feedback.
I found the solution! Running on DigitalOcean, but this is reproducable in any Linux server environment.
node -v
and if the version is greater than v16, you're good. Skip to the next stepnpm install -g n
to install the Node.js version managersudo n stable
to replace your current Node with the latest stable release (will be > v16)