Are there any plans for a Websockets listen function?
Allowing peer to peer applications in the browser could be revolutionary.
I found this answer: Will HTML5 allow web apps to make peer-to-peer HTTP connections? but it is rather old. I think the specification it refers to (the Connection api) has now been replaced with Websockets, which does not mention any listen facility.
The WebSockets API does not provide a way to listen for connections; it is client only.
You might be interested in Opera Unite.
Update:
Also check out pusherapp. It's a WebSockets service online. They charge for over 5 clients, but it's super simple to setup and use. Depending on what your p2p application requirements are, it might suffice.
Old question, but I was wondering the same thing, and came across peer-server, which might be worth having a look at. It uses WebRTC, and looks like it does what you're thinking:
https://github.com/PeerServer/peer-server
Tangentially related to your question, but you did say "p2p in the browser", so..
The Flash player has p2p APIs that allow direct connection with other peers (typically other browsers) over UDP.
The APIs are geared toward using those connections for voice/video streaming, but it seems possible to use them for generic message passing as well.
The tricky point of course is "how do peers find each others?". Currently, Adobe offers a free/beta service to do that, called Cirrus (formerly Stratus). It's also possible to buy Flash Media servers from Adobe to do the same (which also provide TCP server-based fallbacks for folks that are behind UDP-unfriendly firewalls.) Presumably, open-source alternatives like Red5 will have support for it too at some point.
If you are not looking for a generic browser solution, for non secure and limited connections you may use a Google Chrome extension to do the job:
Web Server for Chrome
https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb
Related
I want to launch a new instance of MS Word from my client web browser. Like the way Sharepoint does. How can I do that? I don't want to host the Office file in my browser. I want to edit them in the application itself. People keep saying it is not possible. So how SharePoint does that?
I'm looking for a cross-platform manner.
If a website would be able to launch a process of choice with parameters of choice on the client machine, this would be a massive security breach - basically "game over". If you do not believe this, think e.g. of the process cmd.exe and the parameters /c del /s /y C:\*.*
Sharepoint uses the fact, that it is not "just another website", but part of the trusted network infrastructure, integrated with the windows client and Internet Explorer. Reproducing this in a cross-platform manner is not only extremly technically difficult, but also simply prohibited wherever US patent law is of any importance.
I think I found an answer to this question. By implementing external protocol handler in modern browsers, you can achieve the task of the question. Read more:
External Protocol Handlers and Modern Browsers
https://weblogs.asp.net/morteza/How-to-run-a-desktop-application-from-a-web-page
https://www.codeproject.com/Articles/332206/Custom-URL-Protocol-for-Invoking-Application
I want to demo a web page being used to interact with a physical object in the same proximity as a web-enabled device (Mac/Windows/Linux laptop). In order to do this, I want to create my own window.bluetooth object in Javascript that will provide an interface to the host device's Bluetooth controller via the Serial Port Profile. For now it's just a demo, but I might want to develop a generic API to abstract Bluetooth drivers in Javascript.
I'm not particularly concerned with portability or generic solutions at this point. I just want to see if it would work on my laptop with a device I'm building using a BlueSMiRF Silver modem. I know Google Chrome extensions are capable of injecting Javascript into every page the user visits, and NPAPI is capable of compiling native OS code into a form that can communicate with Javascript. It looks like someone has done something vaguely similar before with slightly more specific applications.
My question is, is a Chrome extension with NPAPI the best way to do this? Alternatives could be Flash or a Java applet, but those are kind of 1996 solutions. Here are the metrics I use to evaluate a solution:
Feasibility. Is it possible?
Ease of development. How many lines of code would it take?
Leverage. Does anything else out there already do something similar?
For those of you thinking it's preposterous for the browser to monitor lower-level network status, it's already been done with Wi-Fi.
Imagine I want to create a realtime multiplayer game, with HTML5 (client) and node.js (server).
I need to transport data very fast from the server to the clients and vice versa.
In a native application I would use UDP for the most data (player position, ...), because it's way faster than TCP and it's uncritical when it is lost.
In HTML5 I can (only) use WebSockets. WebSockets is on top of TCP and thus not fast enough for a good performance.
I heard about WebRTC, but I don't know whether this could be the solution for this problem.
Has anybody experience with it?
(I know, that WebRTC is still unsupported for the most browser, but that doesn't matter to me.)
In terms of WebRTC, sounds like what you need is DataChannel: see draft protocol and HTML5 Rocks article (disclaimer: I wrote it!)
DataChannel is a work in progress, not yet implemented by any browser.
As for other WebRTC components, MediaStream (getUserMedia) is supported by Chrome, Firefox Nightlies and Opera; RTCPeerConnection is in Chrome stable, behind a flag (flagless in forthcoming versions), and promised for Firefox 18 in Q1 2013.
EDIT: RTCDataChannel has now been implemented on Firefox and Chrome.
Chrome 'single page' demo: simpl.info/dc, Firefox demo.
RTCDataChannel provides session-based / reliable as well as connectionless / unreliable transport, analogous to TCP and UDP in a native client, respectively. More information here. As of 2013, this is a viable technology, albeit only in later Chrome and Firefox builds.
According to html5rocks.com, it is also now possible to use binary types for transfer. So you should have all the capabilities you would have with an efficient, native UDP client. However, I am as yet uncertain whether binary transfer has made it's way from the webrtc repository, where it has been fixed, all the way into Chrome, or whether it's still only available in Chrome Canary at this stage.
The title basically says it all. I'm aware this can't be done using traditional means. I'm not aware of any way to do it using Web Sockets, though I've never built anything more than toy apps with them.
It is fine if the solution is browser-specific (even on the client-side; i.e. peer-to-peer communication would also be awesome). For instance, is there any way to accomplish this using Chrome's NaCl?
Furthermore, if this isn't possible now, is there any fleshed-out specification for how it will work in the future? For instance, Chromium-based browsers are experimenting with a "P2P Javascript API" which appears to be currently entirely undocumented.
Here's the HTML5 spec on it:
http://www.whatwg.org/specs/web-apps/current-work/multipage/video-conferencing-and-peer-to-peer-communication.html#peer-to-peer-connections, though its status is unclear.
Sorry if this question is a bit haphazard; I'm basically interested in the current status of all in-browser APIs that could be used for p2p communication.
Edit: I'm not interested in Flash p2p. I'm aware it can be done, and is definitely a solution to current p2p problems, however I'm interested in new technology.
Update May 2012: For those still looking at this, the peerconnection API is slowly making its way into browsers. It is now experimentally in Chrome, along with the rest of the WebRTC API. You can check out the documentation and spec here.
There's Opera Unite but I'm not aware of any cross-browser standardization effort based on that. I think by default it proxies through Opera's servers for DNS, but you can set it up for direct connections.
Is there any way, how to communicate with POP3/IMAP server.
For example for build a pure-JavaScript e-mail notifier?
I've found this:
ftp://ftp.activexperts-labs.com/samples/aemail/HTML/POP3/index.htm
Unfortunately it uses the ActiveX objects, which really doesn't work in many modern browsers.
It would be nice to have ability to send a packet through any protocol (= not only HTTP/S) in HTML5.
It is not possible with purely browser-based Javascript: there are is no direct socket connection support in browser Javascript. You can use special extensions in things like Firefox's Extension environment to do pure socket connections, but not in a standard browser JS file.
My guess would be that the Same Origin Policy implemented in all recent browsers would slap you in the face for this. I'd simply add a server-side layer to mediate between JSON/AJAX and POP3/IMAP - roughly what gmail does.