title: Why i can't call method in subscribe - Cannot read property 'showMessageFromSocket' of undefined
body: <p>I want call method in subscribe block, but I got &quot;Cannot read property 'showMessageFromSocket' of undefined&quot;. How can I call method showMessageFromSocket? In angular it was possible.</p>
  <pre><code>export default class ConnectedChatroom extends Component&lt;
    ConnectedChatroomProps,
    ConnectedChatroomState
  &gt; {
    wsObj: CompatClient;
  
    constructor(props: Props, context: *) {
      super(props, context);
      this.configureSocketChannel('dassfa')
    }
  
    showMessageFromSocket(message)  {
      console.log(message);
      //do something
    }
  
    configureSocketChannel(senderId: string) {
      let ws = Stomp.client(&quot;ws://localhost:8080/chat&quot;);
      ws.connect({}, function (frame) {
        ws.subscribe(&quot;/topic/messages&quot;, function (message) {
          this.showMessageFromSocket(message);
        });
      }, function (error) {
        console.log(&quot;STOMP error &quot; + error);
      });
      this.wsObj = ws;
    }
  </code></pre>