Roberto P. Well-Known Member Licensed User Longtime User Sep 2, 2015 #1 I created an app with B4J that exchanges data with the client, with the stream of binary objects (see example:https://www.b4x.com/android/forum/t...device-desktop-and-web-reports.37254/#content) I need to be able to send data to the server several times, but this is not possible because the stream is closed and does not allow sending data. How can I manage the stream so that it closes? Here's an example of code that I want to achieve Code: Copy Sub Handle(req As ServletRequest, resp As ServletResponse) for i = 0 to 10 dim myObject as CMyObject myObject.inizialize myObject.calulate(params...) SendObject(myObject, resp.OutputStream) next End Sub in this example, it is sent only the first call. I hope I was clear. thank you
I created an app with B4J that exchanges data with the client, with the stream of binary objects (see example:https://www.b4x.com/android/forum/t...device-desktop-and-web-reports.37254/#content) I need to be able to send data to the server several times, but this is not possible because the stream is closed and does not allow sending data. How can I manage the stream so that it closes? Here's an example of code that I want to achieve Code: Copy Sub Handle(req As ServletRequest, resp As ServletResponse) for i = 0 to 10 dim myObject as CMyObject myObject.inizialize myObject.calulate(params...) SendObject(myObject, resp.OutputStream) next End Sub in this example, it is sent only the first call. I hope I was clear. thank you
Erel B4X founder Staff member Licensed User Longtime User Sep 2, 2015 #2 This is how http requests work. The client sends a request and the server responds. You can use WebSockets if you want to maintain an open, bi-directional connection. Upvote 0
This is how http requests work. The client sends a request and the server responds. You can use WebSockets if you want to maintain an open, bi-directional connection.
Roberto P. Well-Known Member Licensed User Longtime User Sep 2, 2015 #3 hello Erel, thanks for the reply I know just the web ... socket can also be used without webpages? or to exchange data between the server and the app B4J B4A? there is an example to exchange data between the two systems? this would be a good solution, for other needs. thank you roberto Upvote 0
hello Erel, thanks for the reply I know just the web ... socket can also be used without webpages? or to exchange data between the server and the app B4J B4A? there is an example to exchange data between the two systems? this would be a good solution, for other needs. thank you roberto
Roberto P. Well-Known Member Licensed User Longtime User Sep 2, 2015 #4 Erel, I found this example: https://www.b4x.com/android/forum/threads/websocket-client-library.40221/#content do you think is okay? Can I use it to transfer objects? I see that after some time times out. Upvote 0
Erel, I found this example: https://www.b4x.com/android/forum/threads/websocket-client-library.40221/#content do you think is okay? Can I use it to transfer objects? I see that after some time times out.
Roberto P. Well-Known Member Licensed User Longtime User Sep 2, 2015 #5 I did a test and there are limitations in the size of the parameters. there is a way to overcome the limits and send via socket size data also some MB? Upvote 0
I did a test and there are limitations in the size of the parameters. there is a way to overcome the limits and send via socket size data also some MB?
Erel B4X founder Staff member Licensed User Longtime User Sep 3, 2015 #6 I wouldn't use the web socket to send large objects. However you can combine both solutions. Maintain an active web socket connection and use a regular handler to upload or download large objects. Upvote 0
I wouldn't use the web socket to send large objects. However you can combine both solutions. Maintain an active web socket connection and use a regular handler to upload or download large objects.
Roberto P. Well-Known Member Licensed User Longtime User Sep 3, 2015 #7 Hello Erel, I understand, I see if I can do this combined management. However, we have to open two doors and manage two separate connections. Upvote 0
Hello Erel, I understand, I see if I can do this combined management. However, we have to open two doors and manage two separate connections.
Erel B4X founder Staff member Licensed User Longtime User Sep 3, 2015 #8 Not sure what you mean with two doors. It is just another handler in the same server. See the WebSocket file upload example: http://b4x.com:51042/websocket_with_fileupload/index.html Upvote 0
Not sure what you mean with two doors. It is just another handler in the same server. See the WebSocket file upload example: http://b4x.com:51042/websocket_with_fileupload/index.html