Method and device for configuring a user agent to operate as a web server
The present invention is directed toward a computer implemented method and device for configuring a user agent (e.g., a web browser) to act as a web server, and host services to be available to the end users of other user agents (e.g., web browsers) acting as clients. Such services may be provided by executing web widgets written in a scripting language, or provided as simple HTML services. The present invention further provides various techniques (e.g., Network Address Translation (NAT) traversal) for allowing requests for a service to pass to the user agent acting as a server, by making such requests appear to a firewall as responses to an initial request made by the user agent.
1. A computer device comprising:
computer-readable storage equipment on which is stored:
computer code for a web browser including:
a script engine;
a web server module configured to receive HTTP requests, execute scripts using the script engine, and transmit data resulting from the executed scripts in response to the HTTP requests, and
a script that is a server widget which, when executed by the script engine, implements a service of producing webpage content which is not static; and
at least one processor configured to execute the web browser in order to:
conduct communications with an external server to establish a communication channel via the Internet through which the executed web browser may receive an HTTP request from a remote device executing another web browser; and
transmit content associated with the script to the remote web browser via the communicative link in an HTTP response to the HTTP request from the remote web browser,
wherein the communication channel is established in such manner that the external server operates as a proxy of the service implemented by the server widget, and both the HTTP request from the remote web browser and the HTTP response from the executed web browser pass through the external server.
2. The computer device of claim 1 , wherein the communication channel is further used to provide a peer-to-peer connection between the executed web browser and the remote web browser for a collaborative application.
3. The computer device of claim 1 , wherein the communication channel is a TCP connection.
4. The computer device of claim 3 , wherein the execution of the web browser further causes the at least one processor to:
perform NAT traversal based on the communications with the external server, the NAT traversal being performed in order to open the TCP connection.
5. The computer device of claim 1 , wherein the execution of the web browser further causes the at least one processor to:
perform NAT traversal to open a TCP connection to the external server; and
register a service, which is provided by the server widget, with the external server via the TCP connection such that the registered service is assigned a URL and listed in a web page transmitted to the remote web browser.
6. A method comprising:
storing a script in a computer device, the script being a server widget which, when executed by the script engine, implements a service of producing webpage content which is not static;
utilizing at least one computer processor to execute on the computing device a web browser including:
a script engine;
a web server module configured to receive HTTP requests, execute scripts using the script engine, and transmit data resulting from the executed scripts in response to the HTTP requests;
the computer device performing the following with the executed web browser:
conduct communications with an external server to establish a communication channel via the Internet through which the executed web browser may receive an HTTP request from a remote device executing another web browser via the Internet; and
transmit content associated with the script to the remote web browser via the communicative link in an HTTP response to the HTTP request from the remote web browser,
wherein the communication channel is established in such manner that the external server operates as a proxy of the service implemented by the server widget, and both the HTTP request from the remote web browser and the HTTP response from the executed web browser pass through the external server.
7. The method of claim 6 , further comprising utilizing the at least one computer processor to use the communication channel to provide a peer-to-peer connection between the executed web browser and the remote web browser for a collaborative application.
8. The method of claim 6 , further comprising utilizing the at least one computer processor to establish the communication channel as a TCP connection.
9. The method of claim 8 , further comprising utilizing the at least one computer processor to perform NAT traversal based on the communications with the external server, the NAT traversal being performed in order to open the TCP connection.
10. The method of claim 6 , further comprising utilizing the at least one computer processor to:
perform NAT traversal to open a TCP connection to the external server; and
register a service, which is provided by the server widget, with the external server via the TCP connection such that the registered service is assigned a URL and listed in a web page transmitted to the remote web browser.
11. A non-transitory computer readable storage device on which are stored computer instructions which, when executed by a computer, executes a web browser which performs the following process:
conducting communications with an external server to establish a communication channel via the Internet through which the executed web browser may receive an HTTP request from a remote device; and
transmitting content to the remote web browser via the communicative link, the content being associated with a script which is stored in the computer, in an HTTP response to the HTTP request from the remote web browser,
wherein the stored script is a server widget which, when executed by the script engine, implements a service of producing webpage content which is not static, and
wherein the executed web browser includes:
a script engine;
a web server module configured to receive HTTP requests, execute scripts using the script engine, and transmit data resulting from the executed scripts in response to the HTTP requests, and
wherein the communication channel is established in such manner that external server operates as a proxy of the service implemented by the server widget, and both the HTTP request from the remote web browser and the HTTP response from the executed web browser pass through the external server.
12. The computer readable storage device of claim 11 , wherein the communication channel is used to provide a peer-to-peer connection between the executed web browser and the remote web browser for a collaborative application.
13. The computer readable storage device of claim 11 , wherein the communication channel is a TCP connection.
14. The computer readable storage device of claim 13 , wherein the process further comprises performing NAT traversal based on the communications with the external server, the NAT traversal being performed in order to open the TCP connection.
15. The computer readable storage device of claim 11 , wherein the process further comprises:
performing NAT traversal to open a TCP connection to the external server; and
registering a service, which is provided by the server widget, with the external server via the TCP connection such that the registered service is assigned a URL and listed in a web page transmitted to the remote web browser.
16. A computer device comprising:
computer-readable storage equipment on which is stored:
computer code for a web browser selectively operating as both a client and a server, the web browser including:
a script engine;
a web server module configured to receive HTTP requests, execute scripts using the script engine, and transmit data resulting from the executed scripts in response to the HTTP requests, and
a script that is a server widget which, when executed by the script engine, implements a service of producing webpage content which is not static, the server widget configured to be executed under control of the web browser; and
at least one processor configured to execute the web browser in order to:
operate the web browser as a client that:
opens a connection to an external server, and
transmits a request to the external server to register an association between the computer device and an IP address to be selected on the basis of the external server's ability to open a return connection to the computer device, and
operate the web browser as a server that:
receives an HTTP request for content associated with the service that is sent by a web browser executing on a remote device based on the registered association, and
transmits to the remote device an HTTP response to the received HTTP request including the content associated with the web server widget,
wherein a communication channel is established between the executed web browser and the remote web browser using the external server such that the external server operates as a proxy of the service implemented by the server widget, and both the HTTP request from the remote web browser and the HTTP response from the executed web browser pass through the external server.
17. A registration/proxy server comprising:
at least one processor configured to perform a process including:
receiving a registration request via a connection opened by a web browser executed by a first computer device;
attempting to open a return connection to the web browser of the first computer device in response to the registration request; and
registering an association between the web browser of first computer device and an IP address in a DNS server,
wherein if the attempt to open the return connection is unsuccessful,
the registration/proxy server registers its own IP address in the DNS server in association with the first computer device, and
upon receiving an HTTP request from a web browser executed by a second computer device for a content provided by a server widget implemented within the first computer device, the registration/proxy server initiates NAT traversal to establish a communication channel between the first computer device and the second computer device,
wherein the web browser of the first computer device includes
a script engine; and
a web server module configured to receive HTTP requests, execute scripts using the script engine, and transmit data resulting from the executed scripts in response to the HTTP requests,
wherein the server widget is one of the scripts executed by the script engine, and
wherein the communication channel is established in such manner that the registration/proxy server operates as a proxy of the service implemented by the server widget, and both the HTTP request from the web browser of the second computer device and the HTTP response from the web browser of the first computer device pass through the registration/proxy server.