I’m using your code and I only see the (“==OnEnable==”) and (“SEND”) console logs on the quest browser
by user 939271426349862963
I’m using your code and I only see the (“==OnEnable==”) and (“SEND”) console logs on the quest browser
by user 939271426349862963
I’m running also the app on the desktop browser and the logs are from the quest browser
by user 939271426349862963
async onEnable()
{
console.log("==OnEnable==");
await delay(1000);
this.context.connection.beginListen("test", (data) => {
console.log(data);
});
const myData = {
time: Date.now(),
};
console.log("SEND");
this.context.connection.send("test", myData);
}
by user 939271426349862963
great, I’m now receiving the message on the desktop browser, thanks for your help!
by user 939271426349862963
Hi, I’d like to ask you some help sending my data over the network. I’ve just recently updated my Needle Engine Package to the 2.67.18 version. I’m trying to send the date for testing, but I’m only receiving: “[object Object]” on the console. Also tried sending my own data through the implementation of my own type, but I receive the same message on the listener
by user 939271426349862963
You’re receiving [object, Object] because you try to add it to a string.
If you want to log it and read it in the browser console just do it like so console.log("some string", data)
console.log
can take as many or few arguments as you like and it will put them in the browser console. It’s pretty nice
Thanks for your quick response, so this line should display the data? console.log("listener received: "+data);
by user 939271426349862963
oh, the “,”
by user 939271426349862963
let me try tht
by user 939271426349862963
wow, it worked. Not sure how that can make a difference hehe but thank you! It worked, I’ll try again sending my data
by user 939271426349862963
Well if you write "a string" + myObject
it will try to concat that random javascipt object. It’s invoking the toString()
method on that object and by default that returns just the type name (it is the same as in c#).
The sending did work the whole time, just the log was “wrong”