Ive been looking around and i cant find an answer for creating a Pure JavaScript Proxy server without node.js. If anyone has an answer please comment. I’m wondering if its possible because i want to set up my own proxy server without node.js so its fully web based.
EDIT 2
So now that i know that i cant directly create a proxy server on the web, is there a way to do it in Java? (Or a similar language)
You cannot accomplish having a proxy server (or any type of server) in the browser. Reason is that proxy servers require a static host that would map data to and from the server.
You will at least need to have a client/server type architecture to accomplish what you're trying to do.
Take a read at: https://en.wikipedia.org/wiki/Proxy_server
Related
I am preparing to build a WebSockets system to have a bidirectional communication from my server to my clients through WebSockets.
I know that Laravel now very well supports 3rd parties like Pusher Channels and Ably.
There are also some other ways that are also very convenient and simple to use such as Laravel Websockets, soketi, laravel-echo-server.
But my problem is client-side cannot include 3rd party Client Library. My client-side is a Cross-platform Game based on Javascript and HTML5. I can only connect client-side to server-side through WebSocket.
As far as I know, when using 3rd party for server-side, I should use their JS Client Library like pusher/pusher-js, laravel/echo ... Therefore, I can't find any documents if I want to use them with WebSocket.
My goal is to find the best and most suitable solution for both client and server side.
What I have tried?
IDEA 1: Convert pusher.js to my own js
I spent 2 weeks on this. I see this as possible and some functions might work. However, it will take a long time if I want to convert the whole thing.
IDEA 2: Using Pusher and connect the client via Pusher Channels Protocol
I have tested them as follows
var socket = new WebSocket('ws://ws-[cluster_name].pusher.com:[port]/app/[key]');
It worked. I can see them connected on the Pusher Debug Console. However, I can't find any documentation regarding the basics like Subcribe channel, Listening events, Send message to other client, Ping, Pong, ...
IDEA 3: Using Laravel Websockets
Like idea 2, I couldn't find any documentation or examples.
IDEA 4: Using NodeJS instead of Laravel. Choose ws packages
I tried it and it worked as expected. WS is really simple but it is exactly what I want. However I don't have many years of NodeJS experience. Therefore, I feel there are many risks if I choose it to build a new project.
Could you tell me a best way to deal with this problem?
Thanks
The Pusher and Laravel Echo JavaScript clients work with any Pusher-compatible websockets host. (Pusher uses websockets, too.)
All it takes is a little configuration; see, for example, Laravel Websockets' guide on configuring Laravel and then configuring Echo. Both steps point your Pusher requests at your chosen Pusher replacement instead.
No need to write your own library or manually consume websocket data.
There is a videogame that uses canvas via socket.io
Using the Chrome developer tool I can see that binary packages are being transmitted containing information that I would like to read from an external medium.
Is it possible to intercept these packets in real time or decode them to be able to read them? Perhaps using JavaScript or another language.
I've been looking for topics related to it but I don't know where to start.
Sounds more like a web proxy to me? A good one is maybe Telerik Fiddler2 or OWASP ZAP to intercept the traffic before hitting your browser (need to configure proxy settings inside the browser to make this work)?
I want to execute some javascript that will send a string of text to a c++/java console application running on the same machine as the web browser
What javascript should I execute? and how should I receive the string?
As far as I know, there are two ways to transmit data to somewhere else using JavaScript. The first is using an XMLHttpRequest, the second is using a WebSocket. In both cases, the JavaScript code will establish a connection to another program, which in this case you want to be your C++/Java program.
In the first case, if you want to communicate using an XMLHttpRequest (or other libraries that use this, such as jQuery's get or post), you'd need to make sure that your C++/Java application starts a small webserver. This way, the JavaScript code can establish a connection to it and send data. I'm sure there are C++/Java libraries which you can use for this, but even if you can't it should be fairly simple to get something to work with just plain socket code. The text-based HTTP protocol that you need for this is not that difficult.
In the second case, you'd need to make sure that a WebSocket server is started in your C++/Java application. Your JavaScript code then can connect to this server and just send its data. I'm not that familiar with the WebSocket protocol but I suspect that it's slightly less trivial, so using a library for this would be a good choice.
I have been working with node.js for a while, now when I'm looking deeper into it, for a chat aplication instead of sending message as client - server - client, there must be some possible ways for direct client to client message sending?
Browsers tend to communicate with servers via HTTP. Some implement other protocols, like websockets & SPDY, but again, these are mostly client-server protocols.
Some plug-ins (like Flash & Java) can open ports and communicate client-client. (AFAIK, haven't actually used them.)
Chrome is the only browser I'm aware of that can (soon) open TCP and UDP sockets from Javascript and do direct client-client communication. At the moment normal web apps can't do this, your app needs to be run as a "Chrome Packaged App", with a special manifest file.
Here are the docs, a blog post describing the feature and a browserify module that can behave like the net node.js module in the browser.
EDIT: This should probably not be tagged as [node.js] since you're trying to run in browsers (not in your node vm), this is a Javascript / Browser question.
This is maybe out of date question, but take a look on PeerJS.
It requires server only as a connection manager (broker). But all communication is done between clients directly.
This does not have anything with server. If you need something like that and if clients are flash you can use RTMFP . For JS i google this library which is js bridge for RTMFP, I dont know how it works. At the end you can write you own library to chat beetween clients but this is much harder(IP addresses are behind NAT, etc...)
I think answer for your question is here
PS Also exist open-source in-browser server which written using JS, but I didn't google it quickly. If you find it, please notify me.
If you just don't want to write your own server you can use:
https://httprelay.io
Use AJAX calls to communicate between peers.
I am new in JavaScript, and now I want to run a Linux application in JavaScript and show the result in a web page. It all happens in client without a server. But for security issues or something else, JavaScript as no such interfaces. I know in Windows, it could be achieved with activeX, but how could I achieve this in Linux?
I just wanna make js+browser equal to a client application without the complex GUI design. So there is no server. Any easy way to accomplish it?
Maybe Node-webkit is what you want.
It allows you to easily create a desktop application in javascript and access "low-level" stuff so you can run commands, without the need of an http server.
Can't be done.
JavaScript cannot interact with the users system in any way.
The only thing you can do is send a request to a server, which executes the command and sends the response back.
With javascript alone can't be done. But you have at least two option to do this using javascript plus other technologies.
The first one is what Jivings sent, using Jquery to sent a post request to a scripting language at the server side.
The second way is to install Node.js. This platform runs on javascript engine, and has all the features you need from the language. After installing it just see this post that explains how to execute a command.