|
41 | 41 | <h1>WebSocket endpoint</h1> |
42 | 42 |
|
43 | 43 | <p> |
44 | | - Mopidy has a WebSocket endpoint at <code>/mopidy/ws</code>. You |
45 | | - can use this end point to access Mopidy's full API, and to get |
46 | | - notified about events happening in Mopidy |
47 | | - <a href="https://docs.mopidy.com/en/develop/api/http/#websocket-api" target="_blank" rel="noopener">more info</a>. |
| 44 | + Mopidy has a WebSocket endpoint at <code>/mopidy/ws</code>. |
| 45 | + You can use this endpoint to access Mopidy's full API, and |
| 46 | + to get notified about events happening in Mopidy. |
| 47 | + <br> |
| 48 | + <a href="https://docs.mopidy.com/en/latest/api/http/#websocket-api" target="_blank" rel="noopener">More info</a> |
48 | 49 | </p> |
49 | 50 | </div> |
50 | 51 |
|
51 | 52 | <div class="box"> |
52 | 53 | <h1>HTTP POST RPC endpoint</h1> |
53 | 54 |
|
54 | 55 | <p> |
55 | | - Mopidy has a WebSocket endpoint at <code>/mopidy/rpc</code>. You |
56 | | - can use this end point to access Mopidy's full API. |
57 | | - However you can't listen to events via this endpoint |
58 | | - <a href="https://docs.mopidy.com/en/develop/api/http/#http-post-api" target="_blank" rel="noopener">more info</a>. |
| 56 | + Mopidy has a non-WebSocket API endpoint at <code>/mopidy/rpc</code>. |
| 57 | + You can use this endpoint to access Mopidy's full API. |
| 58 | + While you can't listen to events via this endpoint, it |
| 59 | + doesn't require maintaining a persistent connection. |
| 60 | + <br> |
| 61 | + <a href="https://docs.mopidy.com/en/latest/api/http/#http-post-api" target="_blank" rel="noopener">More info</a> |
59 | 62 | </p> |
60 | 63 | </div> |
61 | 64 |
|
62 | 65 | <div id="api-intro" class="box"> |
63 | | - <h1>Javascript API</h1> |
| 66 | + <h1>JavaScript API</h1> |
| 67 | + |
| 68 | + <p> |
| 69 | + Mopidy.js is an official library that provides full access to the |
| 70 | + JSON-RPC API via the WebSocket endpoint. For Mopidy extensions, it |
| 71 | + will automatically connect to the WebSocket endpoint with no constructor |
| 72 | + arguments. The examples on this page initiate a connection using the |
| 73 | + following script: |
| 74 | + </p> |
| 75 | + <div class="mb-3 p-2 border rounded"> |
| 76 | + <pre>window.mopidy = new Mopidy();</pre> |
| 77 | + </div> |
64 | 78 | <p> |
65 | | - You can use JS library shipped with mopidy to access |
66 | | - full Mopidy API. For more info visit |
67 | | - <a href="https://docs.mopidy.com/en/develop/api/js/" target="_blank" rel="noopener">mopidy.js</a> docs. |
68 | | - However examples on this page initiate a connection using the following script: |
| 79 | + More info can be found at the <a href="https://docs.mopidy.com/en/latest/api/js/" target="_blank" rel="noopener">Mopidy.js documentation</a> |
69 | 80 | </p> |
70 | | - <pre>window.mopidy = new Mopidy();</pre> |
71 | 81 | </div> |
72 | 82 |
|
73 | 83 | <div id="api-methods" class="box navbar-target"> |
|
0 commit comments