README.md in p2p_streams_channel-0.0.2 vs README.md in p2p_streams_channel-0.0.3

- old
+ new

@@ -46,11 +46,12 @@ ========= Connected ========= -After client-user connected to the host-user, all of them will disconnected to the signaling server (in order to save memory and other things), only the host-user keep connect to Rails server. +After a client-user connected to the host-user, it'll be disconnected to the signaling server (in order to save memory). +Only the host-user keep connect to Rails server. In case you want keep client connection, you could set params `keepCableConnection: true` to the p2p-frame. client-user1 ----X disconnect from -----> Rails server Action cable client-user2 ----X disconnect from -----> Rails server Action cable ... @@ -87,16 +88,10 @@ $ rails g p2p_streams_channel:install ``` ## Usage -Create a Stimulus P2pController in which you will receive other p2p-connections status, data send by other connected connections, and send your data to others. -```ruby -$ rails g p2p_streams_channel:controller chat -# it will create js file `app/javascript/controllers/chat_controller.js` -``` - Render a p2p-frame-tag ```ruby # views/chat_rooms/_chat_room.html.erb <%= p2p_frame_tag( session_id: dom_id(chat_room), @@ -116,15 +111,16 @@ # chat room views </div> <% end %> ``` +Create a Stimulus P2pController in which you will receive other p2p-connections status, data and send back your data to others. +```ruby +$ rails g p2p_streams_channel:controller chat +# it will create js file `app/javascript/controllers/chat_controller.js` +``` -Now you could implement your client side, -for example: here is a simple chat controller: - - ```js // app/javascript/controllers/chat_controller.js import { P2pController } from "p2p" export default class extends P2pController { // @@ -197,12 +193,9 @@ ## Development run test: ```ruby -$ cd spec/dummy -$ rails g p2p_streams_channel:install -$ cd ../.. $ rake spec ``` ## Contributing