php – How to allow other networks to connect to server nodejs socket io-ThrowExceptions

Exception or error:

I am attempting to create a live chat using, currently I can only connect if I am using my own network. (Testing through [ngrok]

How can I allow others to also connect?

socket.js file:

var app = require('express')();
var http = require('http').createServer(app);
var io = require('')(http);

http.listen(3000, function(){
  console.log('listening on *:3000');

io.on('connection', function(socket){
  console.log('a user connected');

  socket.on('chat.message', function(message) {
     io.emit('chat.message', message)

chat.js file:

import io from '';

const socket = io('my_ipv4_address':3000');

var app = new Vue({
    el: '#app',
    mounted: function() {
      console.log('testing 123')
      socket.on('chat.message', function(message) {
    data: {
      messages: [],
      message: null
    methods: {
        send() {
            socket.emit('chat.message', this.message)

How to solve:

@jfriend00 solved the issue.

I also changed

const socket = io('my_ipv4_address':3000');


const socket = io('my_public_ip':3000');

Leave a Reply

Your email address will not be published. Required fields are marked *