How do I create realtime websocket apps with authorization/authentification?

<%= @topic_view.topic.title %>
<%= @topic_view.topic.average_rating %> <%= @topic_view.topic.posts.count { |p| !!p.custom_fields['rating'] } %>

I am new to websockets and want to learn them, however, I was wondering how I can learnto implement them and how to add certain restrictions to them.

For example, I want to send user notifications where the notifications are ONLY received by a particular user (for example, if there are user accounts).

I am wanting to create a forum/message board where replies are automatically updated and where users receive notifications on the app in realtime without having to refresh the page.