Simple message relay

Just started using Construct 2? Post your questions here

Post » Sun Aug 10, 2014 3:57 am

I have been trying to figure this out for days.

I do not know what I am doing. Research on the internet is not helping because much information seems to be outdated.

I need to share a basic data item between two apps. I do not need "chat" I do not need multi-player functions... I just simply need to share a variable between two apps.

These two apps are super simple and they illustrate how incredibly basic my need is.

I am trying to use node.js socket.io and the Websocket object.

I have not been able to get this to work.

App1:
https://drive.google.com/file/d/0B1xzGDQ6NDI-ai14cUJVV0l1Z1E/edit?usp=sharing

App2:
https://drive.google.com/file/d/0B1xzGDQ6NDI-VWdDejJReVdpd1E/edit?usp=sharing

Server script:
https://drive.google.com/file/d/0B1xzGDQ6NDI-TEJjaHVZUFhFMjA/edit?usp=sharing
Last edited by goblynn93 on Sun Aug 10, 2014 5:14 am, edited 1 time in total.
B
10
S
4
G
2
Posts: 133
Reputation: 2,667

Post » Sun Aug 10, 2014 4:55 am

@goblynn93
App2 picture is the same wit App1??.

Just by a glimpse I think you should convert your WebSocket.MessageText into integer first, I might be wrong (I'm not familiar with websocket) but your variable is a number, the one you receive is string. I think it should be like below:

Set visibility to int(WebSocket.MessageText)

Let me know how it goes.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sun Aug 10, 2014 5:14 am

I updated the links. Sorry about that...

I will try your suggestion and see how it goes.
B
10
S
4
G
2
Posts: 133
Reputation: 2,667

Post » Mon Aug 11, 2014 5:46 am

Set visibility to int(WebSocket.MessageText)

Let me know how it goes.[/quote]

Still not working.

If I knew anything at all about JavaScript and/or node.js this would be a lot easier... Maybe I am just missing something and this whole thing is a lot simpler than I've made it but it seems like passing a couple numbers between two apps is really really complicated.
B
10
S
4
G
2
Posts: 133
Reputation: 2,667

Post » Wed Aug 13, 2014 12:29 pm

I'm afraid the issue is in the server script.
You need to create a socket for each app, and maintain some ID to those applications.

As it is, your server is just reacting to the very first application connecting to it. And that's about it. It's not programmed so it would relay any kind of received message.

Moreover, I'm afraid the programming of a server-side script is out of the scope of those forums. You'd need to check out around node.js community to get help on how to properly make your server script.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
293
S
117
G
96
Posts: 7,310
Reputation: 71,069

Post » Wed Aug 13, 2014 9:51 pm

Thank you for the response! This is exactly the info I needed. I actually have a node.js expert working on the communication side of the app now and I am focused on the interface. I am good at the interface... not so much the more complex behind the scenes stuff! I didn't even know node.js existed until a few days ago and I don't know JavaScript at all so bringing in another brain who knows this stuff is a good thing I think.

I did get this working through the Node-Webkit Clipboard and as this app is running on a very controlled situation with no real user I can get away with it. For this app its ok but I plan to make more that have multiple interfaces running at the same time so I need to learn better ways to do this. So I am hoping to learn a bit from my friend the node.js coder and see what he comes up with.
B
10
S
4
G
2
Posts: 133
Reputation: 2,667


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests