epopov
07-06-2004, 02:51 AM
Hello!
I have some problems with laszlo persistent connection engine. I want to sent notification to laszlo app. from Java back-end at any time I need (not the response on the laszlo app. request).
Here is the lzx code:
<canvas debug="true" height="200">
<connection authenticator="anonymous" authparam="usr=frontend" group="backend">
<agent url="http://localhost:8080/app/pers" />
<method event="onconnect">
Debug.write("persistent connection established");
</method>
<method event="ondisconnect">
Debug.write("persistent connection closed");
</method>
</connection>
<script>
connection.connect();
</script>
<connectiondatasource name="myconnection">
<dataset name="msg_msg" />
</connectiondatasource>
<datapointer xpath="myconnection:msg_msg:/*">
<method event="ondata">
Debug.write('Hello');
</method>
</datapointer>
<button>Button
<method event="onclick">
myconnection.sendMessage('*', 'a message', 'msg_msg');
</method>
</button>
</canvas>
So, if I'll send notification to dataset msg_msg, I should see "Hello" in debug console. In Java Servlet I generate query string to my laszlo app. with lzt=agentmessage. Full query string: http://localhost:8080/app/conn_test.lzx?lzt=agentmessage&ccache=false&cache=false&url=http://localhost:8080/app/pers&group=backend&to=frontend&dset=msg_msg&msg=&range=user.
When my servlet executes and send redirect with generated query string to the laszlo app. I don't see 'Hello' in the debug window.
But, when I click on button in laszlo app (code above) sendMessage method executes -> 'Hello' in the debug console. Then I clear up my debug window and excute my Servlet again and the 'Hello' string appears in the debug console!!
Does anybody known what is my problem ?
I have some problems with laszlo persistent connection engine. I want to sent notification to laszlo app. from Java back-end at any time I need (not the response on the laszlo app. request).
Here is the lzx code:
<canvas debug="true" height="200">
<connection authenticator="anonymous" authparam="usr=frontend" group="backend">
<agent url="http://localhost:8080/app/pers" />
<method event="onconnect">
Debug.write("persistent connection established");
</method>
<method event="ondisconnect">
Debug.write("persistent connection closed");
</method>
</connection>
<script>
connection.connect();
</script>
<connectiondatasource name="myconnection">
<dataset name="msg_msg" />
</connectiondatasource>
<datapointer xpath="myconnection:msg_msg:/*">
<method event="ondata">
Debug.write('Hello');
</method>
</datapointer>
<button>Button
<method event="onclick">
myconnection.sendMessage('*', 'a message', 'msg_msg');
</method>
</button>
</canvas>
So, if I'll send notification to dataset msg_msg, I should see "Hello" in debug console. In Java Servlet I generate query string to my laszlo app. with lzt=agentmessage. Full query string: http://localhost:8080/app/conn_test.lzx?lzt=agentmessage&ccache=false&cache=false&url=http://localhost:8080/app/pers&group=backend&to=frontend&dset=msg_msg&msg=&range=user.
When my servlet executes and send redirect with generated query string to the laszlo app. I don't see 'Hello' in the debug window.
But, when I click on button in laszlo app (code above) sendMessage method executes -> 'Hello' in the debug console. Then I clear up my debug window and excute my Servlet again and the 'Hello' string appears in the debug console!!
Does anybody known what is my problem ?