1) How would I connect through a proxy if I am using the Socket class to connect to a server?
2) If I am running my Flex application through Flash Player in a webbrowser and my webbrowser is configured to use a proxy, does the socket connection go through the proxy automatically?
Ideally, I would like to not have to depend on the web browser's settings, and be able to programmatically proxy the connection from my own code. By supporting proxies directly, I can compile it as a desktop AIR application and still support proxying the connection. Additionally, there may be cases where more than one socket connection will need to be created to different proxies.
Using Action Script 3 in Flex Builder 3.
Thanks.
You may not be able to do this with the vanilla Socket class, but check out this post by Christian Cantrell of Adobe (Google cache version) about a specialized socket class he wrote to allow "TCP socket connections through HTTP proxies in accordance with RFC 2817". His class, the winningly-named RFC2817Socket.as (github), is used by Open Flash Chart. As Christian notes in his post, there are some caveats and it may not work for you if your server doesn't support RFC 2817, or if there are certain other conditions which aren't met.
Note that on Windows, the Flash Player uses IE's proxy settings and ignores the settings of the actual browser you're using.
I've had a look and it doesn't seem possible to do exactly what you want to do. If you have control of a server you can route requests through a server yourself ... and Adobe has examples of this using their Flex Data Access services (BlazeDS and LiveCycle) to go through a proxy. Then again if you control your own server you can get it to proxy anyway you like ...
But I'm afraid there doesn't seem to be anyway to directly set a proxy on the client side using ActionScript.
As for Flash respecting the browsers proxy, I can't say I know from first-hand experience but the evidence from searching isn't good. Here is an article that claims flash won't use your browsers proxy setting for SOCKS on Linux and suggests you need to alter your iptables. There is also this adobe bug report suggesting it doesn't work for rtmp connections at least. Other anecdotal evidence suggests that it works sometimes (for HTTP requests) for some browsers.
So if you need to guarantee that a connection goes through a proxy it looks like you'll need to route your requests through a server and proxy from there.
You can't do that with a regular HTTP or SOCKS proxy. Flex shares browser's connection settings.
But you still can bypass that by using what they call PHP Proxy, basically a website which downloads another websites and forwards the result to you.
Related
Our setup is like this: we use a coldfusion 10 server, and files are on a local intranet. Users use a domain login to access any files over https. I'm interested in using html5 websockets, but the first attempt gave me an error because no credentials were supplied. Is there a way around this? If not, is there a recommended technology for this scenario?
The user does log in on the client side. If it's possible, what I'd really like to do here is pass those credentials when making the connection to the server.
you should be able to supply the authentication header to your web socket server before the elevation to web socket read that and send it back in the headers for the elevation (first frame) then when the browser connects it should have the authentication it needs.
if your using a custom authentication E.G in page not authentication header you can also do this by passing any custom header to your server.
Or mandate that the first thing your web client sends is the authentication details this could be something like {username_hash}.{password_hash} if they don't close the socket to them.
Do not do this.
You're now responsible for sending and encrypting the authentication credentials yourself, bypassing something that already works and is tested.
Anyone can snoop on an unencrypted websocket port. Use HTTPs for an intranet, use stable solutions, don't reinvent this wheel because it tickles your fancy.
In a couple of years some colleague will have to maintain this and will have to figure out how your homebrew version works versus something that's solid like plain browser authentication.
My advice: Leave this to the browser and to well-tested coldfusion libraries.
I have an AIR app that need to communicate via OSC with a remote server.
I'm somewhat confused by the differences between this 'Flosc' AS3 library
https://code.google.com/p/flosc/
and TUIO AS3
https://code.google.com/p/tuio-as3/
since they both allow OSC communication.
Can anyone shed some light on this? Is TUIOAs3 simply more powerful?
I see the last updates have been around 2011 on both.
I think FLOSC is slighly older and relies on running a UDP Server for OSC connectivity which then is bridged to as3 via the Socket class(which is TCP)
This bridge is the java application available on the FLOSC repository download list. On OSX they recommend Memo's udp-tcp-bridge.
tuio-as3 includes OSC support which you need and the nice thing about it is that it can also make use of AIR's udp functionality, so you won't need the java or c++ UDP to TCP Bridge.(the simpler the better, you'll have to worry about 2 apps being configured properly, not 3 as you would with FLOSC)
I'd recommend tuio-as3 if you're not sure, especially since you already have a basic as3 example from last year (which I hope was helpful).
I've been reading abit about html5, websockets and http. I made some simple tests but let's say I want to do this:
Browser makes an http connection to a web server
Browser then negotiates a web socket connection to the same web server
At some point browser wants to talk http again with the web server in the same session
Points 1 and 2 are straightforward. Coming to point 3, is there a standard solution available? I'm guessing that closing a web socket by either side terminates the existing connection right? Can there be a way to perform a "downgrade" from websockets back to http?
I guess what I'm looking for is a standards-based solution but if one doesnt exist, do any frameworks exist that can do the job?
Thanks :o)
Nina
Is it possible to open a port using Native Client that other browsers can connect to? Like a browser to browser connection?
In general, no. NaCl does not allow programs to open sockets directly (that would be a security problem). It is intended that NaCl/Pepper applications have the same general capabilities as Javascript applications; so something like WebSockets (connection back to the server) would be supported, but not directly opening files or sockets on the client machine. There's some work going on to have a P2P style networking in HTML5 (e.g. http://www.w3.org/TR/2008/WD-html5-20080122/#peer-to-peer) which would likely get Pepper support as well, but I don't know what the status of that is.
The only way to get P2P connection in browser is through WebRTC. If NaCl allows to use WebRTC (though Pepper API or whatever) then the only thing you need besides implementation is broker server that will connect clients with each other. See PeerJS for some info.
Two connected qustions
I understand that non HTML5 browser can connect to websockets using flash.
https://github.com/gimite/web-socket-js
1. However is there an implementation of websockets for flash inside flash?
2. If I were to use normal flash sockets, would the sockets work if there were multiple instances of the flash file running on a local network connecting to an external socket server. Would the messages intended for one instance be forwarded to all instances
Here is a Flash implementation for use in Flash itself: https://github.com/y8/websocket-as
I'm not sure what you are asking but it sounds more like a question about the WebSockets server application and that completely depends on your application.