B4J Question difference between jnetwork and jWebSocketClient

ArminKH

Well-Known Member
Hi
2Days ago i use Jwebsocketclient lib on b4j and i Create a simple comunication between b4a and b4j which that use a timer on server side and send the server's time to show in label on b4a.
Every thing is okay but as i said on other threads i want to know my message(on this sample is server's time)delivered to client or not.then as @Erel said i use jNetwork lib and AsyncStreamObject to solve this problem
But now i have an other problem again
When i send server's time to client by using JwebSocketClient every thing is okay but when i send server's time to b4a by using JNetwork then i see 2 min after b4j started my server's time value on client side updated after 2 or 3 seconds
Note.my timer's interval is 1000 on server side and my connection is between b4a and local host.so b4a is always connected to b4j
I think by using jNetwork server's cpu or ram usage is higher
Is this wrong?
Note.this problem happen when i connect 2 device at the same time to my server
But after 2 or 3 min messages delivered with a bit delay
Please help me
I like JwebSocketClient but that is limited because then we cant to use AsyncStreamObject
Thanx
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are confusing different technologies so I'm not sure what to answer you.

If you want to use low level sockets then you should use jNetwork + AsyncStreams.
If you want to create a http server that also supports web sockets then you should use jServer. http://en.wikipedia.org/wiki/WebSocket
 
Upvote 0

ArminKH

Well-Known Member
@Erel
Ok yes you are correct.i am so confused.
2 or 3 days ago i create a chat app with jserver and websocket but by using this way never i can understand whether any message delivered or not.then as you said on my creation thread which you suggest me to use Jnetwork + AsyncStreamObject for solve this issue today again i create an other chat app by using this solution and all thing now are okay
Erel i am still so begginer i ask question if i cant solve my problem.i am sure you know this is not easy for me when i am non-english user and u can see this on my translation
Okay if you want help me please just suggest one of the following solutions
*** I WANT to create a chat app which is able to send and recieve text message,images,files to an other device and recieve delivered message similar to any other chat apps like viber telegram....
I want my app (and my connections)be standard , quick ,safe and simple
As my searches the jnetwork+ AsyncStreamObject is suitable for me
Now which is your suggestion
Jnetwork+AsyncStreamObject ?
Or Jserver + WebSocketClient ?
Erel please correct me on this topic really i am so tired to switch between this two solution every day
Thank u
 
Last edited:
Upvote 0

iconia

Member
Licensed User
Longtime User
I would suggest Jnetwork.
It allows connection from one app to another in a simple way.

WebSocketClient is more for webservers talking to javascript on webpages. This is good for a web based chat.

You could use a web server for people to find each others ip addresses, then use jNetwork so they can connect to each other.
 
Upvote 0

ArminKH

Well-Known Member
Thank u i have not any problem to create chat app but i want to know best way,i am wait 4 @Erel's answer if thats not be "start new thread :-D"
If we want to arrive to a place we can use car or use horse but which way is better at this time?
Thank u again ;-)
 
Upvote 0

ArminKH

Well-Known Member
You are confusing different technologies so I'm not sure what to answer you.

If you want to use low level sockets then you should use jNetwork + AsyncStreams.
If you want to create a http server that also supports web sockets then you should use jServer. http://en.wikipedia.org/wiki/WebSocket
Excuse me for limit my question to u
But i think just you can answer to me and i am still wait for u and if you dont tell your idea then i dont start developing my app :-(
 
Upvote 0

ArminKH

Well-Known Member
Assuming that you aren't trying to make a direct connection between two devices then you should implement a real server with jServer + web sockets.
Ok but as you said on other thread to me about a way to know whether messages are delivered or not then we should use jnetwork + AsyncStream
Is ther any same way on jserver and websocketclient?
 
Upvote 0

ArminKH

Well-Known Member
I recommend you to take your time and learn how the server handlers and the websocket handlers work. The answer to your question is yes. You can know when messages are delivered based on the response from the server.
Thank u i will learn basics about socket programming again
excuse me for questions
I cant find any relevant taturial or question about this solution on jserver + websockey
Have u any suggestion?or i should make other thread?
 
Upvote 0
Top