Does anyone have a clue how to wait for a message from a connected socket in an applet ?
The applet basically needs to connect to a socket on a third party server and after that I want the applet to receive incoming messages from the third party server.
I obviously can't have a blocking read on the socket in the applet since it will block SqueezePlay, preferably I want something similar to how the notify_* methods in the applet works but I guess I'm going to have to implement parts of it myself since we aren't talking about a LMS server and LMS messages here.
Does anyone have a clue how to do this ?
Or at least know where I should start looking ?
I've dived down into luasocket and the lua files in jive/net/Socket*.lua but it's not that easy to "decifer" them to something I can understand, I'd at least want to understand if what I want to do is even possible.
The main goal is that I have a C library which is heavily multi threaded (using pthread) and have an API where you register callback functions and I want the information recevied in those callbacks to end up in a Applet where can can easily communicate with SqueezePlay and LMS. The callbacks are called by the C library from different threads. I've already made a simple binary executable written in C which talks directly to the API and expose the interface as a socket, the question now is just how to make the lua Applet listen to the socket without blocking SqueezePlay completely. The reason I did it over a socket is that I felt it was a good idea to avoid trying to integrate directly with lua since I've read that lua and multi threading can be somewhat tricky.
I'm open to alternative solutions, if sockets isn't the best way to do this.
Results 1 to 3 of 3
Thread: Using sockets in an applet ?
-
2012-07-13, 06:08 #1
Using sockets in an applet ?
Erland Isaksson (My homepage)
(Developer of many plugins/applets (both free and commercial).
If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)
You may also want to try my Android apps Squeeze Display and RSS Photo Show
Interested in the future of music streaming ? ickStream - A world of music at your fingertips.
-
2012-07-13, 10:40 #2Senior Member
- Join Date
- Apr 2005
- Posts
- 6,932
Not sure if its what you want - but look in my BBCRadio applet - this has a very partial xmpp client which listens to a xml messages on an open socket and then updates the now playing information based on it. (used for BBC xmpp based now playing updates.) Mentioning as it sounds similar. You essentially want to create callbacks and register the socket with select.
-
2012-07-14, 06:55 #3Erland Isaksson (My homepage)
(Developer of many plugins/applets (both free and commercial).
If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)
You may also want to try my Android apps Squeeze Display and RSS Photo Show
Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

Reply With Quote

