Running a Node.js app in Snap!

I need to run the Thymio API in Snap! but it's only available in Node.js.
Is there an already existing process or should I try to browserify it ?

Thanks for your answer.

I am not certain about Node.js but maybe the code can be executed using snap javascript block

I can't help with original request but it may be possible/easier to see how they've got Scratch controlling it and try and use or copy that method

For others, Thymio is a lovely nice robotic vehicle from Switzerland

I'll have to dust mine off and charge it up and see if I can do anything from Snap! with it
Its showing some sign of life :slight_smile:
(Been about 5 years since last powered so might need battery replacing)

Thank you but I already had a look on Scratch's app for Thymio but it is encapsulated. The low levels API are not available.

You can't run servers and native programs in the browser.
You'll have to install Node.js and run it from there.

I know this, thank you. But, I need to communicate with a websocket client to send some text and I don't know how to do that in Snap!.

This is exactly what I'm trying to do. Scratch works on Thymio by establishing a WebSocket connection.

I'd recommend deleting your other thread and just keep using this one as it is confusing to have two threads on the same basic subject :slight_smile:

Ok. So here is my post :

I need to run a web page inside Snap! to communicate with a websocket client like here :

<html><head><script src="bundle.js"></script></head>
	Test api Toto
	// var toto_0 = totoApi.createClient("ws://");
	var toto = new Toto();
	toto.sendCode("call toto_function(0,255,255) \n");

Could you help me to do that ? Or give me some examples. Thanks.

I can't delete it.

Just delete each post (or edit the 1st first one to link to here) and delete your second one