the problem is when countries like Iran “ban” nostr clients, it makes it extremely complicated for the average person to use it. There should a guide on how to use nostr if a country bans the clients on app stores
Discussion
Should be fairly simple to just use snort, coracle, primal etc on a browser?
Is there a great firewall there?
i’m not sure if they have that blocked yet or not on browser, but i wouldn’t doubt it.
It would be cool if someone created an app that connected a WebSocket Secure (WSS) feed directly to a mobile app.
let url = URL(string: "wss://nymsrelay.com")!
let task = URLSession.shared.webSocketTask(with: url)
task.resume()
func receive() {
task.receive { [weak self] result in
switch result {
case .failure(let error):
print("Error in receiving message: \(error)")
case .success(let message):
switch message {
case .string(let text):
print("Received string: \(text)")
case .data(let data):
print("Received data: \(data)")
@unknown default:
fatalError()
}
self?.receive() // Listen continuously
}
}
}
func send(text: String) {
task.send(.string(text)) { error in
if let error = error {
print("Error in sending message: \(error)")
}
}
}
For Android:
val request = Request.Builder().url("wss://your-websocket-url").build()
val listener = object : WebSocketListener() {
override fun onOpen(webSocket: WebSocket, response: Response) {
webSocket.send("Hello, it's me.")
webSocket.close(NORMAL_CLOSURE_STATUS, "Goodbye!")
}
override fun onMessage(webSocket: WebSocket, text: String) {
println("Receiving : $text")
}
override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
webSocket.close(NORMAL_CLOSURE_STATUS, null)
println("Closing : $code / $reason")
}
override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {
t.printStackTrace()
}
}
val ws = client.newWebSocket(request, listener)