B4A Library WebSocket Client Library

Status
Not open for further replies.

TAK

Member
Licensed User
Longtime User
Don't confuse the server code (B4J) with B4A code.
ok, i just would like to unterstand how it works, to learning B4A and B4J faster.
What is the timer1 doing? Connecting the Server with client every 1000ms?
I saw the StartMessageLoop several times but stil dont really unserstand what it is doing.

thx
 

sasidhar

Active Member
Licensed User
Longtime User
Hi,

The example is working well for me on my local computer. Once I deployed at server where I have Public IP, Jar file could not run. Getting error while running Jar file.

Apart from Jar file anything need to implement at server.

Please help.

Below error I got while executing Jar file.

D:\New Folder>java -jar result.jar
2015-05-16 09:20:07.381:INFO::main: Logging initialized @400ms
2015-05-16 09:20:07.663:INFOejs.Server:main: jetty-9.1.z-SNAPSHOT
2015-05-16 09:20:07.725:WARNejh.MimeTypes:main: java.util.MissingResourceExcep
tion: Can't find bundle for base name org/eclipse/jetty/http/encoding, locale en
_GB
2015-05-16 09:20:07.803:INFOejsh.ContextHandler:main: Started o.e.j.s.ServletC
ontextHandler@51016012{/,file:/D:/New%20Folder/www,AVAILABLE}
2015-05-16 09:20:07.819:INFOejs.AbstractNCSARequestLog:main: Opened D:\New Fol
der\logs\b4j-2015_05_16.request.log
2015-05-16 09:20:08.210:INFOejs.ServerConnector:main: Started ServerConnector@
5ba23b66{HTTP/1.1}{0.0.0.0:51042}
2015-05-16 09:20:08.210:INFOejs.Server:main: Started @1285ms


Thanks
Sasidhar





 

ArminKH

Well-Known Member
@Erel
I dont know this is a bug or not but i think thats better if i report this
Please follow this steps:
1-Run your server on local host(created by b4j)
2-click on connect button on your client side
Now you see the is trying to connect to server
3- turn on your phone wifi hotspot and connect your pc to this network
Now you see your app connect to the server and wsh_connected event raised
4-turnoff your internet connection on pc (not turn off your wifi hotspot)
now you see _disconnected event raised on server side but wsh_closed not raised on client side and our app stil is connected to server without network connection
Why?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The disconnected event is raised from the network driver. There maybe cases where the device mistakenly thinks that is is connected.

The solution for such issues is to use a "heart beat" mechanism to automatically close the connection when there is no data. You can see it in this example: Custom WebSocket Based Push Framework
 

ArminKH

Well-Known Member
can we send and recieve files or pictures between client and server over websocket by using this lib?how?
 

ArminKH

Well-Known Member
This library allows you to send strings between the client and the server. You can encode the images with base64 encoding though it will not be very efficient.
Thats not any limits on size?(large image)
What about other type of files such as music or zip files????
 
Last edited:

ArminKH

Well-Known Member
It doesn't matter whether it is an image or any other file. I don't recommend you to use this method for non-small files. Use regular server handler instead.
I am not familar with regular server handler
Whats your aim?
My search came up with noting for this
Thanx
 

ArminKH

Well-Known Member
If is possible please give me a relevant link on this forum
 

ArminKH

Well-Known Member
I see all of this many times
At some of them u use httputils on both side
Or use jnetwork + async stream
Or use connection between 2 device over wifi or bluetooth
Ok erel thank u
Every time i ask a question again i was more confused
If u want to help me please answer my questions at this thread

https://www.b4x.com/android/forum/t...ext-messages-between-client-and-server.54506/

Stillllllll i dont know what is regular server handler
I know this ide is free and thank u for free support but i am so begginer erel and i want to learn
If i dont understand thats not matter but if i dont ask thats soooooooo defect
Excuse 4 my english
Thanx
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…