Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Arcane94 · Dec 19, 2018 at 02:26 PM · socketnodejsemit

Socket Io Client sent messages are not received at the Node Js server.

Here is the client inside Game Engine... I'm using the following library for this.

Socket io

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 using SocketIO;
 
 public class Communication : MonoBehaviour {
     
     public GameObject go;
     SocketIOComponent socket;
     Dictionary<string, string> data;    
     
     
     void Start () {
         go = GameObject.Find("SocketIO");
         socket = go.GetComponent<SocketIOComponent>();
         
         data = new Dictionary<string, string>();
         data["email"] = "some@email.com";
         data["pass"] = "1234";        
         Debug.Log("Test123");
         socket.Emit("messages", new JSONObject(data));
     }
     
 }
 

Following is the server that I'm running inside my PC. (Outside Unity)

 var app = require('express')();
 var http = require('http').Server(app);
 var io = require('socket.io')(http);
 
 app.get('/', function(req, res){
     res.send('<h1>Hello world</h1>')
 });
 
 io.on('connection', function(socket){
     console.log('a user connected');
 
     socket.on('disconnect',function () {
         console.log('User Disconnected...')
     });
 
     socket.on('messages',function (msg) {
          console.log('HELLO');
          console.log(msg);
     });
 
 });
 
 
 http.listen(80, function(){
     console.log('listening on *:80');
 });


Client connects to the server but it doesn't print out the received message. Actually, the following line doesn't print either.

console.log('HELLO');

Even in the client, following line prints nothing on the console.

Debug.Log("Test123");

Am I doing something wrong? Any help is much appreciated.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Valentinon13 · Jun 16, 2019 at 12:00 AM 0
Share

Hi still need a hand ???

avatar image derkjanspeelman Valentinon13 · Aug 17, 2019 at 10:57 AM 0
Share

Yes please

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by InfinityChaos102 · Nov 11, 2020 at 05:22 PM

ANYONE HAVE SAME PROBLEM ATTENTION:

  • Because the package work well in the past so what you need is get in the time machine.

  • Or ... you can uninstall the SocketIO on your node server and reinstall the older version


i delete version 3, re-install version 2.1.1 and it's work


cd YourServerPath

npm uninstall socket.io

npm install socket.io@2.1.1


You guys are wellcome :Đ

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

99 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Webplayer connecting to TCP server: No connection could be made because the target machine actively refused it 2 Answers

How do I connect to a server in LAN from a different computer? I'm using socket.io and nodejs 1 Answer

How to stream audio from unity app to the web browser? 0 Answers

How to set namespace in packet of socketIO using unity3d 1 Answer

How to connect Node.js + Unity? 7 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges