Weinre JS API onload/ready event - node.js

I'm using Weinre to debug an iPad App and was looking for a JS callback from Weinre that signals when Weinre has finished loading and e.g. it's safe to use its console object in my code.
I looked through the docs and the target-script.js that hooks Weinre into my page but couldn't find anything.
Any help would be appreciated.

I think by "safe to use the console" object, you mean, when will writing to the console object start writing to the remote console window. If so, that's a tough proposition, as your app might NEVER connect to a client debugger. Or the client debugger might connect, then disconnect, then connect, ... There would really need to be two events - weinreConnected and weinreDisconnected, or some such.
I didn't want to have to add new events to the system, but if there's a lot of interest, we can probably make it happen. Feel free to open a Jira issue for a new feature.

Related

Buildfire: Debugging on IOS Test Flight

I can't seem to figure out why my plugin works fine on the Web App mode, versus the IOS Test Flight.
It seems like an angularjs dependency is not loading correctly, but I have no way of knowing.
Not sure what your app/plugin situation is precisely. However, a good place to start would be here https://github.com/BuildFire/sdk/wiki/App-Developer-Mode this will allow you to test your code live on the device without publishing. It hijacks the plugin and loads your localhost version so that you can test on the fly changes.
Also, you may want to try shipping logs with http://debug.buildfire.com this will allow you to read console logs remotely

How can i setup a Socket.io client on flutter?

I have a flutter app and i am trying to connect it to a node.js localhost server. it works with react js but I haven't done it in flutter before. can I get help on sending a simple connection to my server socket io?
It's pretty easy. You'll basically have to use this package to connect to your backend. The idea is pretty similar to JavaScript applications.
In case you need it, I already implemented a simple application using it on Flutter. It's pretty straightforward and you only have to focus on mobile/lib/config/socket.dart which is my socket client.
It contains three simple methods used to emit events and subscribe/unsubscribe to events. Any doubts just ask it.
EDIT:
In case you have any problem connecting to your backend add this line to your Android Manifest. I remember I had some problem because of the android version which had cleartext disabled by default.

NightmareJS without closing the browser

I'm used to PhantomJS and Watir, which both provide a REPL out of the box. The REPL lets me execute automation calls on a currently-running browser.
This is a fun way to make automation scripts because I can watch the effect of each step as I build an automation script.
In fact, I can even write a script that defines methods for opening a browser, performing a log-in, and other common tasks, and then call them as I please from within the generic Node or Ruby REPL.
Can I execute NightmareJS calls without closing the browser (Electron)?
Without closing? Yes - don't call .end().
If you're asking if you could disconnect the IPC - meaning the calling program ends but does not end the Nightmare instance - and then pick up the Nightmare instance again somewhere else, the answer is no.
#393 (packaging Nightmare functions with an existing Electron application) and #593 (covering v3 wants, including one Electron instance for many applications) are related, but I'm not convinced attaching IPC from new calling applications is a great idea.
If you provide more information about what your circumstances are and what you're trying to do, I'll edit this answer to try to help.
Having a REPL is a different question - I will add it to my list of things to look into. It's a good idea.

Node.js unresponsive until key press on console

I have a Node.js app, that runs on a Windows Server 2008. I'm facing a weird problem here.
My app does more than one async tasks. Sending data to socket.io, MySQL, HTTP connections, TCP connections etc.
My Node app becomes unresponsive especially on the socket.io end, and only starts responding back again after any key press on the console. Is this a known issue? Any bypasses around such a behavior?
Note: I am using console.log heavily to keep track of the current operation and errors in process.
I did a bit of a background check and came to the following conclusions.
The Powershell console on Windows Server 2008 goes on a 'pause' mode when clicked on it. It is released again if you click elsewhere.
http://www.vistax64.com/powershell/112032-script-pauses-when-you-click-powershell-text-window.html
If you notice, console.log is async. But console.warn and console.error are blocking. These are not async.
The console pause might block some/most part of the Node.js operations. Esp. as Socket.io at default debugging level will report with more than just console.log.
Solutions that other people have suggested didn't work for me, but using Cmder to start the script solved it. Definitely appears to be a console application problem, rather than a node.js problem.
I faced the same problem in a Windows Machine with my Node.js server running on PowerShell.
I solved it disabling Quick Edit Mode and Insert options in the Properties panel of PowerShell. It seems like pause the process when you click on the terminal with those two options enabled.
Hope this helps you, bro.

Console & Logging In Node.js From A HTTP interface

I have a difficult question that needs some answering, i have seen some projects where
the application runs a socket in a browser that has a console like format that the user can run for their node.js module...
If the actually calling a function or script is impossible from the web side,
i think it would be nifty to just see the console logs in the window.
If any advice could be shared, that would be amazing!
Thanks :)
Yes, there are several projects that do this. Weinre is very commonly used. You can look at its source code to see how it does it.
If I were to build it from scratch, I would utilize Socket.IO. Send the command, return the result.

Resources