How to tell websocket server to accept incoming connections? - phpwebsocket

I have started using the websocket php example in http://code.google.com/p/phpwebsocket/ It works pretty well on localhost but unfortunately, no client other than localhost can connect to the websocket server. And whenever I change the path to something like http://10.27.50.25:8787/client.html, it does not let the client to connect. Does anyone have any idea/sample about how to fix it?
Thanks in advance

Could be a crossdomain problem. Modern browsers prevent access to hosts other than the one where the page loaded from. You can get around it by providing JSON as an output then using jQuery Ajax JSON parsing.

Related

HTTPs method VS Web socket

after some reasearch
knowing websocket is lighter than https method post and get
however in term of security, post is more secure than websocket.
as i could still use web socket even my server restart(logged out)
in this case, i found that i couldnt check if that particular user is authenticated user or not.
or maybe im wrong.
please correct me.
im using express js and https and i had done some action using https post.
(in here socket automatically using secure connection as https) but the problem is authentication
so my question here is.
i want to turn them into websocket as its lighter.
can web socket check if the one sending is authenticated and session is still active(e.g logged out user cant emit)?
or should i stick with https post?
if there is a way to authenticate emitted socket(from client to server)... please share with me here
thanks alot
instead of doing another authentication,
i had found something nice here and its works.
https://www.codementor.io/tips/0217388244/sharing-passport-js-sessions-with-both-express-and-socket-io
i could use existing passport authentication on my socket
note: since im using mongodb
then i do not use radis.. instead i use mongostore for the session store from npm connect-mongo
hope this will help other

HTTP proxy for Appium in native apps?

I was wondering if somebody has an idea what Java/Groovy library/tool to use for sniffing, recording and processing HTTP traffic of native apps when running Appium tests ? Does anybody has experience with Browser Mob for that specific case ? Thanks! Best, Daniel
Yes browsermob can be used used with native apps and selenium. We tried many other network sniffing proxies but browsermob works best for selenium.
Can be done in 3 simple steps(not so simple by the way).
Run browsermob from standalone server and get response as har in localhost
Write code to validate your output.
Call browsermob methods in your selenium code to call
Validate the response you got with code you have already written for validation.
Mostly validation involves parsing JSON files as most of https responses will be in JSON format.
If you need help in any specific area of browsermob proxy or selenium or running feel free to ask me.

Facing issue while trying to check the Incoming request in Fiddler

I am trying to check the incomming request to my server. Another server which has hosted MVC application. An action method is sending some data to my server. I am using Fiddler. But somehow it is not showing the incoming request.
Below mentioned are my settings in Fiddler Custom Rules..
static function OnBeforeRequest(oSession: Session) {
if (oSession.host.toLowerCase() == "IP Address:8888")
oSession.host = "IP Address:82";
}
Below mentioned are my Fiddler Options.
Am I missing anything ?
It sounds like you're trying to use Fiddler as a reverse proxy. You should read the steps at http://www.fiddler2.com/r/?reverseproxy. The biggest thing to understand is that when running as a reverse proxy, you only see traffic in Fiddler if the client's URL is changed to point at Fiddler.
If it is ssl connection then you need to enable option 'capture https connection' from 'https' tab. Did you try to invoke request from other browser like chrome ? Does fiddler capture anything?
You don't need custom rule for this case. It should work if you enable these settings. I have faced only some problems in other browsers like FF.
I'm not sure I can answer your question fully without knowing a few additional pieces of information.
If the request being made is not a HTTP request, Fiddler will not be able to handle it.
Also, if you're using the loopback address localhost then Fiddler may not be able to find it.

Ruby on rails without http request

I'm currently developing a server that can get data over the internet from specific device i have and log it into a database. Unfortunately I dont have control on the way this device communicate.
Currently I set an IP adress and a port number and the device will open a socket and send a string. I dont really want to develop a server from scratch and i would much prefer to base on a web server. but the data is a plain string and not a full http request.
Is there a way around it using Ruby on rails ? Is it possible to do with other web-server-based technology ?
Thanks a lot
You can use just a regular old ruby socket to receive the string.
Sounds like an application that node.js would be useful for, if you want a pre-made node+rails app which would do what you want check out compound at GitHub mentioned in this article

Connection refused while web scraping using HTMLUnit

I am trying to build a java application to scrape a website using HTMLUnit. After extracting some data the application encounters following exception -
java.lang.RuntimeException: org.apache.http.conn.HttpHostConnectException: Connection to siteURL refused.
If I run application again, it is able to extract some data again before failing with the same exception. Probably the server see lot of requests from same client IP and refuses connection for a request.
Also, when application encounters this problem, I am able to connect to the site using a browser.
How can I overcome this problem? In web scraping applications how are such problems approached and resolved?
This is how I debug such issues :
Download Fiddler
By default, fiddler listens on port 8888, all you have to do, is configure webClient to use fiddler as proxy & then all requests being sent can be seen (analyzed, modified & re-sent too) in fiddler.
client.getOptions().setProxyConfig(new ProxyConfig("127.0.0.1", 8888));
From what I can say from my previous experience is that the target site blocks after some-time, you can try adding a pause or rotating proxies & user-agents. You can also try clearing cookies.

Resources