Can my ExpressJS website and socket.io port use the same port?

Viewed 2372

I've been coding ExpressJS websites which use socket.io for realtime communication, and I use the same port always

const request = require('request')
const express = require('express')
const app = express()
const server = require('http').Server(app)
const io = require('socket.io')(server)
    server.listen(3000, () => {
  console.log(`Server started: http://localhost:3000`)
})

Is it safe / a healthy practice to use the same port for both the websocket and the express server. Will it cause any problems?

1 Answers
Related