Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CometD for status updates #23

Closed
CDrummond opened this issue Nov 27, 2018 · 3 comments
Closed

Use CometD for status updates #23

CDrummond opened this issue Nov 27, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@CDrummond
Copy link
Owner

Currently material polls the server for status and serverstatus updates, this should be change to use cometd. Some initial investigation has been done in the cometd branch.

@CDrummond CDrummond added the enhancement New feature or request label Nov 27, 2018
@CDrummond
Copy link
Owner Author

SqueezeCtrl:

19-04-03 16:39:29.3316] Slim::Web::Cometd::handler (150) Cometd request (192.168.1.74:45460): [
  {
    channel => "/meta/handshake",
    ext => {
          mac  => "de:03:57:21:c3:3e",
          type => "Squeeze Control Android/2.1.3",
          uuid => "d46bc93c03ee4b0e98d2a40b3617228b",
        },
    id => 1,
    "supportedConnectionTypes" => ["streaming"],
    version => "1.0",
  },
]
[19-04-03 16:39:29.3351] Slim::Web::Cometd::Manager::add_client (43) add_client: 4b81aff9
[19-04-03 16:39:29.3410] Slim::Web::Cometd::sendHTTPResponse (725) Sending Cometd response (192.168.1.74:45460):
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 203
Content-Type: application/json
Expires: -1
X-Time-To-Serve: 0.0174479484558105

[{"supportedConnectionTypes":["long-polling","streaming"],"advice":{"reconnect":"retry","interval":0,"timeout":60000},"version":"1.0","clientId":"4b81aff9","successful":true,"channel":"/meta/handshake"}]
[19-04-03 16:39:29.3601] Slim::Web::Cometd::handler (150) Cometd request (192.168.1.74:45460): [
  {
    advice => { timeout => 0 },
    channel => "/meta/connect",
    clientId => "4b81aff9",
    connectionType => "streaming",
    id => 2,
  },
]
[19-04-03 16:39:29.3627] Slim::Web::Cometd::handler (254) Client (re-)connected: 4b81aff9
[19-04-03 16:39:29.3647] Slim::Web::Cometd::Manager::register_connection (54) register_connection: 4b81aff9
[19-04-03 16:39:29.3695] Slim::Web::Cometd::sendHTTPResponse (725) Sending Cometd response (192.168.1.74:45460):
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: application/json
Expires: -1
X-Time-To-Serve: 0.014415979385376

[{"timestamp":"Wed, 03 Apr 2019 15:39:29 GMT","clientId":"4b81aff9","advice":{"interval":5000},"successful":true,"channel":"/meta/connect"}]
[19-04-03 16:39:29.3908] Slim::Web::Cometd::handler (150) Cometd request (192.168.1.74:45462): [
  {
    channel => "/meta/subscribe",
    clientId => "4b81aff9",
    id => 3,
    subscription => "/4b81aff9/**",
  },
  {
    channel => "/slim/subscribe",
    clientId => "4b81aff9",
    data => {
          request  => [
                        "",
                        ["serverstatus", 0, 50, "prefs:jivealbumsort", "subscribe:60"],
                      ],
          response => "/4b81aff9/slim/serverstatus",
        },
    id => 4,
  },
]
[19-04-03 16:39:29.3940] Slim::Web::Cometd::Manager::add_channels (124) add_channels: /4b81aff9/** ((?^:^/4b81aff9/)) for 4b81aff9
[19-04-03 16:39:29.4023] Slim::Web::Cometd::handleRequest (900) Request for /4b81aff9/slim/serverstatus / 4 is not async
[19-04-03 16:39:29.4053] Slim::Web::Cometd::Manager::deliver_events (241) Sending event on channel /4b81aff9/slim/serverstatus to 4b81aff9
[19-04-03 16:39:29.4248] Slim::Web::Cometd::Manager::deliver_events (255) Delivering events to 4b81aff9:
[
  {
    channel => "/4b81aff9/slim/serverstatus",
    data => {
          "info total albums" => 868,
          "info total artists" => 274,
          "info total duration" => "3345115.01433333",
          "info total genres" => 72,
          "info total songs" => 12_844,
          jivealbumsort => "artflow",
          lastscan => "1554034499",
          mac => "aa:bb:cc:dd:ee:ff",
          "other player count" => 0,
          "player count" => 3,
          players_loop => [
                {
                  canpoweroff => 1,
                  connected => 1,
                  ...,
              ],
          uuid => "06eaee3c-c21f-416b-80ef-47b4517ff2d8",
          version => "7.9.2",
        },
    ext => { priority => "" },
    id => 4,
  },
]
[19-04-03 16:39:29.4294] Slim::Web::Cometd::sendHTTPResponse (731) Sending Cometd chunk (192.168.1.74:45460):
[{"id":"4","channel":"/4b81aff9/slim/serverstatus","ext":{"priority":""},"data":{"info total genres":"72","info total albums":"868","version":"7.9.2","info total duration":3345115.01433333,"mac":"aa:bb:cc:dd:ee:ff","uuid":"06eaee3c-c21f-416b-80ef-47b4517ff2d8","info total songs":"12844","info total artists":"274","players_loop":[{"isplaying":"0","name":"Player1","firmware":"0","canpoweroff":"1","ip":"127.0.0.1:55992","isplayer":"1","modelname":"SqueezeLite","playerindex":"0","displaytype":"none","playerid":"11:22:33:44:55:66","seq_no":"0","uuid":null,"power":"1","connected":"1","model":"squeezelite"},{"canpoweroff":"1","firmware":"7.7.3-r16676","modelname":"Squeezebox Radio","isplayer":"1","ip":"192.168.1.26:55319","playerindex":"1","isplaying":"0","name":"Bedroom","power":"0","connected":"1","model":"baby","displaytype":"none","seq_no":"59","playerid":"00:04:20:26:66:0b","uuid":"eecb68e04eceba8fbc11e87025db1248"},{"uuid":null,"seq_no":"0","playerid":"80:19:34:d5:0a:02","displaytype":"none","model":"squeezelite","power":"1","connected":"1","name":"SqueezeLite","isplaying":"0","playerindex":"2","ip":"192.168.1.66:58166","isplayer":"1","modelname":"SqueezeLite","canpoweroff":"1","firmware":"v1.8"}],"lastscan":"1554034499","jivealbumsort":"artflow","other player count":"0","player count":"3"}}]
[19-04-03 16:39:29.4344] Slim::Web::Cometd::sendHTTPResponse (725) Sending Cometd response (192.168.1.74:45462):
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 180
Content-Type: application/json
Expires: -1
X-Time-To-Serve: 0.0516929626464844

[{"clientId":"4b81aff9","subscription":"/4b81aff9/**","channel":"/meta/subscribe","successful":true},{"clientId":"4b81aff9","id":"4","successful":true,"channel":"/slim/subscribe"}]
[19-04-03 16:39:29.4817] Slim::Web::Cometd::handler (150) Cometd request (192.168.1.74:45462): [
  {
    channel => "/slim/subscribe",
    clientId => "4b81aff9",
    data => {
          request  => ["11:22:33:44:55:66", ["menustatus"]],
          response => "/4b81aff9/slim/menustatus/11:22:33:44:55:66",
        },
    id => 5,
  },
  {
    channel => "/slim/subscribe",
    clientId => "4b81aff9",
    data => {
          request  => [
                        "11:22:33:44:55:66",
                        ["status", "-", 4, "menu:menu", "useContextMenu:1", "subscribe:30"],
                      ],
          response => "/4b81aff9/slim/playerstatus/11:22:33:44:55:66",
        },
    id => 6,
  },
  {
    channel => "/slim/subscribe",
    clientId => "4b81aff9",
    data => {
          request  => [
                        "11:22:33:44:55:66",
                        ["displaystatus", "subscribe:showbriefly"],
                      ],
          response => "/4b81aff9/slim/displaystatus/11:22:33:44:55:66",
        },
    id => 7,
  },
  {
    channel => "/slim/subscribe",
    clientId => "4b81aff9",
    data => {
          request  => ["favorites", ["changed"]],
          response => "/4b81aff9/slim/favorites/11:22:33:44:55:66",
        },
    id => 8,
  },
]
[19-04-03 16:39:29.4845] Slim::Web::Cometd::handleRequest (777) Treating request as plain subscription: [["menustatus"]]
[19-04-03 16:39:29.4870] Slim::Web::Cometd::handleRequest (800) Subscribed for /4b81aff9/slim/menustatus/11:22:33:44:55:66, callback CODE(0x3e416c8)
[19-04-03 16:39:29.4925] Slim::Web::Cometd::handleRequest (900) Request for /4b81aff9/slim/playerstatus/11:22:33:44:55:66 / 6 is not async
[19-04-03 16:39:29.4943] Slim::Web::Cometd::Manager::deliver_events (241) Sending event on channel /4b81aff9/slim/playerstatus/11:22:33:44:55:66 to 4b81aff9
[19-04-03 16:39:29.5070] Slim::Web::Cometd::Manager::deliver_events (255) Delivering events to 4b81aff9:
[
  {
    channel => "/4b81aff9/slim/playerstatus/11:22:33:44:55:66",
    data => {
          alarm_next               => 0,
          alarm_snooze_seconds     => 540,
          alarm_state              => "none",
          "alarm_timeout_seconds"  => 0,
          alarm_version            => 2,
          base                     => {
                                        actions => {
                                              more => {
                                                    cmd => ["contextmenu"],
                                                    itemsParams => "params",
                                                    params => { context => "playlist", menu => "track" },
                                                    player => 0,
                                                    window => { isContextMenu => 1 },
                                                  },
                                            },
                                      },
          count                    => 0,
          "digital_volume_control" => 1,
          "mixer volume"           => 31,
          mode                     => "stop",
          player_connected         => 1,
          player_ip                => "127.0.0.1:55992",
          player_name              => "Player1",
          "playlist mode"          => "off",
          "playlist repeat"        => 0,
          "playlist shuffle"       => 0,
          playlist_tracks          => 0,
          power                    => 1,
          preset_data              => [...
                                      ],
          preset_loop              => [1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
          seq_no                   => 0,
          signalstrength           => 0,
        },
    ext => { priority => "" },
    id => 6,
  },
]
[19-04-03 16:39:29.5106] Slim::Web::Cometd::sendHTTPResponse (731) Sending Cometd chunk (192.168.1.74:45460):
[{"ext":{"priority":""},"data":{"preset_loop":["1","1","0","0","0","0","0","0","0","0"],"playlist mode":"off","alarm_snooze_seconds":"540","playlist_tracks":"0","mixer volume":"31","alarm_timeout_seconds":"0","power":"1","mode":"stop","player_ip":"127.0.0.1:55992","digital_volume_control":"1","alarm_state":"none","signalstrength":"0","playlist shuffle":"0","preset_data":[{"type":"audio","URL":"http://opml.radiotime.com/Tune.ashx?id=s6818&formats=aac,ogg,mp3&partnerId=16&serial=2f213046d53b664ca733e4d81682d47f","text":"Heart Hampshire"},{"text":"Planet Rock","type":"audio","URL":"http://opml.radiotime.com/Tune.ashx?id=s2377&formats=aac,ogg,mp3&partnerId=16&serial=44d4e56e31871af5947d2e438bfaa0d3"},{},{},{},{},{},{},{},{}],"player_connected":"1","alarm_version":"2","base":{"actions":{"more":{"player":"0","params":{"context":"playlist","menu":"track"},"cmd":["contextmenu"],"window":{"isContextMenu":"1"},"itemsParams":"params"}}},"seq_no":"0","alarm_next":"0","playlist repeat":"0","player_name":"Player1","count":"0"},"id":"6","channel":"/4b81aff9/slim/playerstatus/11:22:33:44:55:66"}]
[19-04-03 16:39:29.5140] Slim::Web::Cometd::handleRequest (900) Request for /4b81aff9/slim/displaystatus/11:22:33:44:55:66 / 7 is not async
[19-04-03 16:39:29.5159] Slim::Web::Cometd::Manager::deliver_events (241) Sending event on channel /4b81aff9/slim/displaystatus/11:22:33:44:55:66 to 4b81aff9
[19-04-03 16:39:29.5189] Slim::Web::Cometd::Manager::deliver_events (255) Delivering events to 4b81aff9:
[
  {
    channel => "/4b81aff9/slim/displaystatus/11:22:33:44:55:66",
    data => {},
    ext => { priority => "" },
    id => 7,
  },
]
[19-04-03 16:39:29.5214] Slim::Web::Cometd::sendHTTPResponse (731) Sending Cometd chunk (192.168.1.74:45460):
[{"data":{},"ext":{"priority":""},"channel":"/4b81aff9/slim/displaystatus/11:22:33:44:55:66","id":"7"}]
[19-04-03 16:39:29.5237] Slim::Web::Cometd::handleRequest (777) Treating request as plain subscription: [["changed"]]
[19-04-03 16:39:29.5261] Slim::Web::Cometd::handleRequest (800) Subscribed for /4b81aff9/slim/favorites/11:22:33:44:55:66, callback CODE(0x612cf40)
[19-04-03 16:39:29.5295] Slim::Web::Cometd::sendHTTPResponse (725) Sending Cometd response (192.168.1.74:45462):
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 317
Content-Type: application/json
Expires: -1
X-Time-To-Serve: 0.0580511093139648

[{"channel":"/slim/subscribe","id":"5","successful":true,"clientId":"4b81aff9"},{"channel":"/slim/subscribe","successful":true,"id":"6","clientId":"4b81aff9"},{"clientId":"4b81aff9","id":"7","successful":true,"channel":"/slim/subscribe"},{"clientId":"4b81aff9","channel":"/slim/subscribe","id":"8","successful":true}]
[19-04-03 16:39:29.5411] Slim::Web::Cometd::handler (150) Cometd request (192.168.1.74:45464): [
  {
    channel => "/slim/request",
    clientId => "4b81aff9",
    data => {
          request  => [
                        "11:22:33:44:55:66",
                        ["status", "-", 4, "menu:menu", "useContextMenu:1"],
                      ],
          response => "/4b81aff9/slim/request/0",
        },
    id => 9,
  },
]
[19-04-03 16:39:29.5460] Slim::Web::Cometd::handleRequest (900) Request for /4b81aff9/slim/request/0 / 9 is not async
[19-04-03 16:39:29.5480] Slim::Web::Cometd::Manager::deliver_events (241) Sending event on channel /4b81aff9/slim/request/0 to 4b81aff9
[19-04-03 16:39:29.5601] Slim::Web::Cometd::Manager::deliver_events (255) Delivering events to 4b81aff9:
[
  {
    channel => "/4b81aff9/slim/request/0",
    data => {
          alarm_next               => 0,
          alarm_snooze_seconds     => 540,
          alarm_state              => "none",
          "alarm_timeout_seconds"  => 0,
          alarm_version            => 2,
          base                     => {
                                        actions => {
                                              more => {
                                                    cmd => ["contextmenu"],
                                                    itemsParams => "params",
                                                    params => { context => "playlist", menu => "track" },
                                                    player => 0,
                                                    window => { isContextMenu => 1 },
                                                  },
                                            },
                                      },
          count                    => 0,
          "digital_volume_control" => 1,
          "mixer volume"           => 31,
          mode                     => "stop",
          player_connected         => 1,
          player_ip                => "127.0.0.1:55992",
          player_name              => "Player1",
          "playlist mode"          => "off",
          "playlist repeat"        => 0,
          "playlist shuffle"       => 0,
          playlist_tracks          => 0,
          power                    => 1,
          preset_data              => [...
                                      ],
          preset_loop              => [1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
          seq_no                   => 0,
          signalstrength           => 0,
        },
    ext => { priority => "" },
    id => 9,
  },
]

@CDrummond
Copy link
Owner Author

Working on this in the 23-cometd branch.

@CDrummond
Copy link
Owner Author

Implemented in master for 0.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant