To publish a stream, User B uses
the Session.publish method:
User B publishes a stream; User A is notified that User B has published a stream
The Session.publish() method starts publishing an audio/video stream to
the session, and displays the video being streamed on the local web page as
directed in the method invocation.

The session sends a streamCreated event to all
connections. The event object for
this event is of type StreamEvent. The StreamEvent
object includes an array of Streams.
Through this event, User A's web page can learn that User B has started publishing a stream, and can choose to subscribe to it as shown in the next workflow.
Note that User B's web page is also notified of the stream they are now
publishing. User B's web page can know that a streamCreatedEvent references its own published stream by comparing
the new stream's connection.connectionId property to its own connection ID. In
most cases, User B's web page will choose to ignore the notification.
You can restrict users from publishing to a session. Users in the subscriber role can only subscribe to streams in a session (they cannot publish). For more information, see Connection Token Creation.
Next workflow step: Subscribe to a stream.