nginx-push-stream-module
nginx-push-stream-module copied to clipboard
Backtrack should be a GET param
To be more REST compatible the backtrack option should be a GET parameter instead of munching it together with the resource aka channel_id.
The resource you work on is the channel_id. When mixing in the backtrack param you are accessing another resource which by definition should have nothing in common with the channel you want information on. In other words $channel_id.b5 is another resource (simply with another name like 6.b5) and thus should not return the stored message of the channel you actually want to access.
A desired and valid call to get the last 5 message of the resource/channel 6 would be:
/sub/6?backtrack=5
Hi this is not a REST service. Actually we support subscribe to more than one channel using the same connection, this is done using channels ids on url, like /sub/ch1/ch2. To get old messages on this channels you may do /sub/ch1.b3/ch2.b6. If we change to be like a REST service this will not be possible to be done.
I know this is not a rest service but it would be easy to comply to rest standards, so you could use it as a rest service.
To connect to more than one channel a GET on the resource /sub with query params could be used:
GET /sub?channel=1&channel=2&backtrack=1.6&backtrack=2.3
+1 on this - it'd be great to customise where the backtrack parameter can be passed in from, perhaps using a push_stream_backtrack_tag option.
Hi,
I'm checking what we can do about that, but I had some doubts. If we follow your suggestion, and the user has many channels on the same connection or some channels with big names, the query string will be huge.
GET /sub?channel=A&channel=B& ... channel=X&channel=Z&backtrack.A=6&backtrack.B=3& ... backtrack.X=6&backtrack.Z=3
GET /sub?channel=a_very_bid_channel_name_like_a_session_id&backtrack.a_very_bid_channel_name_like_a_session_id=6
You really think this is the best approach?
I thought in some other options
#using a dot notation
GET /sub?channel=A.6&channel=B.3
#using brackets notation
GET /sub?channel=a_very_bid_channel_name_like_a_session_id[6]
In any case the "channel" and "backtrack" parameters names will be configurable.
What do you think?