Yet another thorough solution to live performances with instant comments.
cmtsvr/: Server-side application with Node.js.player/: Client-side HTML pages. These are automatically served by running the server-side application.
- Make sure you have a relatively-new version of Node.js installed. (v5.10.1 works, others untested)
- On your server, clone the repository and
cdto the project in a terminal. - Run
cd ./cmtsvr. - Run
npm installto install dependencies. - Run
npm testto run tests. (Optional) - Modify
cmtsvr/main.jsto set the passes of different roles. - Run
npm startto start the whole application.
http://<ip>:6033/*will be the commenting API server.http://<ip>:6033/player/*will be the player's static file server.- The ports above can be specified with the
$PORTenvironment variable, for instance runPORT=8080 npm start. - The default HLS stream to play is
http://localhost:6060/master.m3u8.- Can be changed at
player/play.html. - Can be tested with
HLS Endless.
- Can be changed at
- (POST body): (String) the pass
Verification. Send a secret pass as the whole request body to prove that the server is an authorized IM server.
Body sample: $$$letmeinImtheWeChatserver$$$
- (POST body) uid_sub: (String) the sub-client ID
Creates a new sub-client. Enclose an ID (OpenID, etc.) of a user in the request to notify the server of a newcomer.
Body sample: uid_sub=d41d8cd98f00b204e9800998ecf8427e
- (POST body) uid_sub: (String) the sub-client ID
- (POST body) text: (String) the text of the comment
- (POST body) attr: (String) the attribute in the form of
<colour>;<position>, where<position>is a charactert(top) orb(bottom)
Creates a new comment. The sub-client ID should be registered by /new_client first.
Body sample: uid=d41d8cd98f00b204e9800998ecf8427e&text=Hello+World&attr=#ffffff;t
Note: bodies in encoded-form or JSON format can both be accepted.
Remove(Done)/new_clientand handle regstration internallyTest the IM APIs(Done)Use an environment variable to decide the port to listen on(Done)- Folder structure refactoring
- WeChat integration