WebSocket Server / Client

Hello Guys,

I have an access card reader which works via TCP/IP and the documentation says that they use WEBSOCKET+JSON protocol and they provide me 36 pages of details, however I did tried some tests and it seems that on XOJO I cannot have this one working .

Initially I tried the Network example the server socket, the client works with the server but the machine once setup to communicate with that server it does not do anything and it seems that if I send something to the machine then it hangs and does not do anything anymore.

Is there anything in particular that I should be aware on the XOJO side ?

The idea was to have a web app as server and then to get the logs from that machine, as that should send the logs automatically to the server once connected.

Is the ServerSocket and TCPSocket the correct approach or not ?

Thanks

WebSocket and TCPSocket are two different things.
Basically WebSocket connects to a Webservice and tells it that it wants to use Websocket to keep a connection alive.

Have you tried those?

And there’s this expensive plugin:

https://www.chilkatsoft.com/refdoc/xojoWebSocketRef.html

Why do all plugins cost more than Xojo itself? :wink:

I wrote a WebSocket server to facilitate communication between the Xojo side of my app, and the HTMLViewer side. Since Xojo beefed up how these two can communicate back and forth, I no longer use it but if anyone is interested, they’re welcome to have a copy of the relevant items.

Well it would help to have an idea of how this works as so far it seems that there is no way to have this working.

Based on the documentation this was supposed to send data to the server and be able to accept queries but so far nothing works.

They did provided a sample app but is all in Java so I’ll have to dig into that to see what the app does and how might be able to work with XOJO if ever will.

Thanks

Well to me it sounds very strange that a card reader would implement websocket for accessing it…only when it wants to send something back on his own, which a plain webservice can’t.

Maybe you can share a link to their API or send it via PM to have a look at it…

Well that is the thing I get apparently Sample app and API hopefully it helps

Not really much…and I hate Java as well…even before it belonged to Oracle (o;

From the first look it seems the card reader likes to connect to a webserver with websocket extension…and not that you connect with a client to it.

So the card reader has some settings where you specify the servers IP address or hostname?

yes, in my case you set

Server mode and If yes then you can add the following

Use domain name
Server IP
Server Port no
Heartbeat
Server approval

In my case it was set for port no 7005 so I assumed that my port should be 7005 for server side and I know that the device communicates on 5005

Also an old project:

https://www.dropbox.com/s/ug4nvr6e7g5p91r/WebSocketServer.zip?dl=0

The others I mentioned above are only clients…

But without any real setup it is not easy to help any further…

Another question maybe…

What do you want to achieve with Xojo…or what is the intended end application?

POS terminal?

I did once a POS for my girlfriends shop based on a all-in-one PC with touchscreen and Python/Kivy as Xojo has no touchscreen support and probably never will (o;

Thanks Richard,

It seems that once I run that one and I put the reader to talk to it on my Mac it keeps on sending some data, I assume that this is the heartbeat

Based on the data I get, normally based on the docs I have it should send Unit ID and as well the Unit serial number which in a way I see the serial but then I see those weird characters.

Now the doc says that the encoding should be UTF-8 but still is weird


this is the original


this is the binary

and this is the UTF-8

those are some Door controllers and the idea behind it was to be able to control them and collect the logs from them for attendance and audit purposes as their apps that they provide are very messy and often fails. But it seems that the unit itself as well is not quite reliable if they say something in the docs but I discover new things on the device and it seems that their app does a lot more than the api that they provided.

Sorry for the misunderstanding…though about card read in terms of payment terminal…as just my girlfriend had recently problems with an acceptance parter (o;

But why a Xojo app for it? You would a PC running all the time.

Wouldn’t a small server handling those things much better based on Linux and a webserver handling the websocket communication or a python daemon?

At least for Linux and/or Python there are much more sample applications out there.

Well, I wanted to use XOJO, but as usual with most of my projects, I will end up using python or other languages, let’s say just trying to use XOJO but as usual , always I end up disappointed and get something else that gets the job done .

To be honestly…I use Python all the time…especially on Linux as Xojo on Linux is somehow abandoned, and touchscreen will never make it through…that’s probably why it is now free…

I would suggest a Python daemon a cheap Raspberry who also logs everything in a database, PostgreSQL preferably, and a webserver providing all that information to users.

If you need more assistance, I’m always here to help via PM.