Method and system for real-time communication between multiple browser windows
A method for real-time communication between multiple browser windows by a system ( 100 ). The method includes opening, by the processor ( 180 ), a parent browser window and determining, by the processor ( 180 ), child browser window needs to be opened by the parent browser window. The method also includes receiving, by the processor ( 180 ), an input for creating a communication channel between the parent browser window and the child browser window and opening, by the processor ( 180 ), the child browser window from the parent browser window. Further, the method includes creating, by the processor ( 180 ), the communication channel between the parent browser window and the child browser window based on the received input; and receiving, by the processor ( 180 ), data by the child browser window from the parent browser window through the created communication channel.
1 . A method for communication between multiple browser windows in real-time by a system, wherein the method comprises:
opening, by a processor of the system, a parent browser window;
determining, by the processor, at least one child browser window needs to be opened by the parent browser window while the parent browser window is opened;
receiving, by the processor, an input for creating a communication channel between the parent browser window and the at least one child browser window;
opening, by the processor, the at least one child browser window from the parent browser window, the at least one child browser window having a different web application source origin than the parent browser window;
creating, by the processor, the communication channel between the parent browser window and the at least one child browser window based on the received input; and
receiving, by the processor, data by the at least one child browser window from the parent browser window through the created communication channel,
wherein opening, by the processor, the at least one child browser window from the parent browser window comprises:
determining, by the processor, that another child browser window comprising a same child browser window name does not exist already with the parent browser window; and
opening, by the processor, the at least one child browser window from the parent browser window based on determining that the other child browser window comprising the same child browser window name does not already exist with the parent browser window, such that the at least one child browser window is not opened if the other child browser window comprising the same child browser window name does exist already with the parent browser window.
2 . The method as claimed in claim 1 , wherein the input for creating the communication channel comprises at least one of a uniform resource locator (URL) for the at least one child browser window, a communication channel name indicating the communication channel between the parent browser window and the at least one child browser window, a parameter for indicating whether the at least one child browser window is one of a new browser window and a new tab in the parent browser window and a plurality of parameters indicating dimensions of the at least one child browser window.
3 . The method as claimed in claim 1 , wherein receiving, by the processor, the data by the at least one child browser window from the parent browser window through the created communication channel comprises:
sending by the at least one child browser window an initialization event to the parent browser window for performing a handshake;
accepting by the parent browser window the initialization event sent by the at least one child browser window and performing the handshake;
authenticating the handshake received from the parent browser window by the at least one child browser window based on a communication channel name of the communication channel created between the parent browser window and the at least one child browser window;
sending the data by the parent browser window to the at least one child browser window through the created communication channel; and
receiving the data by the at least one child browser window through the created communication channel from the parent browser window.
4 . The method as claimed in claim 1 , further comprises:
determining, by the processor, that the at least one child browser window needs to be closed;
automatically sending, by the processor, a response comprising output data from the at least one child browser window to the parent browser window to reallocate a dump memory associated with the at least one child browser window.
5 . The method as claimed in claim 1 , further comprises:
determining, by the processor, that the parent browser window is closed when the at least one child browser window is still open;
sending, by the processor, a notification to the at least one child browser window that the parent browser window is closed; and
automatically closing, by the processor, the at least one child browser window.
6 . The method as claimed in claim 1 , wherein the input for creating the communication channel comprises a uniform resource locator (URL) for the at least one child browser window, the URL being different than a URL for the parent browser window.
7 . The method as claimed in claim 1 , wherein the input for creating the communication channel comprises a parameter for indicating whether the at least one child browser window is a new tab in the parent browser window.
8 . The method as claimed in claim 1 , wherein the determining the at least one child browser window needs to be opened by the parent browser window while the parent browser window is opened, comprises determining to open the at least one child browser window in response to an email notification or a social network activity notification being received.
9 . A system for communication between multiple browser windows in real-time, wherein the system comprises:
a memory storing instructions;
a processor coupled to the memory;
a communicator ( 140 ) coupled to the memory and the processor; and
wherein the processor is configured to execute the stored instructions to:
open a parent browser window,
determine at least one child browser window needs to be opened by the parent browser window while the parent browser window is opened,
receive an input for creating a communication channel between the parent browser window and the at least one child browser window,
open the at least one child browser window from the parent browser window, the at least one child browser window having a different web application source origin than the parent browser window,
create the communication channel between the parent browser window and the at least one child browser window based on the received input, and
receive data by the at least one child browser window from the parent browser window through the created communication channel,
wherein the processor is configured to open the at least one child browser window from the parent browser window by executing the instructions to:
determine that another child browser window comprising a same child browser window name does not exists already with the parent browser window; and
open the at least one child browser window from the parent browser window based on determining that the other child browser window comprising the same child browser window name does not already exist with the parent browser window, such that the at least one child browser window is not opened if the other child browser window comprising the same child browser window name does exist already with the parent browser window.
10 . The system as claimed in claim 9 , wherein the input for creating the communication channel comprises at least one of a URL for the at least one child browser window, a communication channel name indicating the communication channel between the parent browser window and the at least one child browser window, a parameter for indicating whether the at least one child browser window is one of a new browser window and a new tab in the parent browser window and a plurality of parameters indicating dimensions of the at least one child browser window.
11 . The system as claimed in claim 9 , wherein the processor is configured to receive the data by the at least one child browser window from the parent browser window through the created communication channel comprises:
send by the at least one child browser window an initialization event to the parent browser window for performing a handshake;
accept by the parent browser window the initialization event sent by the at least one child browser window and performing the handshake;
authenticate the handshake received from the parent browser window by the at least one child browser window based on a communication channel name of the communication channel created between the parent browser window and the at least one child browser window;
send the data by the parent browser window to the at least one child browser window through the created communication channel; and
receive the data by the at least one child browser window through the created communication channel from the parent browser window.
12 . The system as claimed in claim 9 , wherein the processor is further configured to:
determine that the at least one child browser window needs to be closed;
automatically send a response comprising output data from the at least one child browser window to the parent browser window to reallocate a dump memory associated with the at least one child browser window.
13 . The system as claimed in claim 9 , wherein the processor is further configured to:
determine that the parent browser window is closed when the at least one child browser window is still open;
send a notification to the at least one child browser window that the parent browser window is closed; and
automatically close the at least one child browser window.