How to connect to a mobile connection using android?

I'm new to Android development, and I'm trying to add a chat application to my Android app that runs Rail new actioncable. I am currently chatting using Firebase, which is great. However, I would like to have additional features that are not supported by Firebase, so I want to move everything to my server. The problem is that I know little about websites on Android.

The following is the javascript information used on the browser side of rails. This works without a problem.

hostname = (url) ->
  parser = document.createElement('a')
  parser.href = url
  parser.href = parser.href
  parser.protocol = parser.protocol.replace("http", "ws")
  parser.href

@App = {}
App.cable = Cable.createConsumer hostname("/")

App.messages = App.cable.subscriptions.create "MessagesChannel",
  received: (data) ->
    messages = $('#messages')
    messages.append(data.message)
    messages.scrollTop(messages.height() + 1000)
+4
source share

Source: https://habr.com/ru/post/1617742/


All Articles