Skip to content

Not connecting to socket on IOS version #52

@Usama99786

Description

@Usama99786
 val socket = Socket(
        endpoint = "http://handwi.com:4005",
        config = SocketOptions(
            queryParams = mapOf("" to ""),
            transport = SocketOptions.Transport.DEFAULT
        )
    ) {
        on(SocketEvent.Connect) {
            println("SocketConnected123")
            val payload = buildJsonObject {
                put("search", "")
                put("page", "1")
                put("limit", "20")
                put("user_id", "28")
                put("last_read_time", "")
            }

          emit("get_posts", payload)
        }

        on(SocketEvent.Connecting) {
            println("connecting")
        }

        on(SocketEvent.Disconnect) {
            println("disconnect")
        }

        on(SocketEvent.Error) {
            println("error ${it.cause}")
            println("error123 ${it.message}")
        }

        on(SocketEvent.Reconnect) {
            println("reconnect")
        }

        on(SocketEvent.ReconnectAttempt) {
            println("reconnect attempt $it")
        }

        on(SocketEvent.Ping) {
            println("ping")
        }

        on(SocketEvent.Pong) {
            println("pong")
        }

        on("observePublicPosts") { data ->
            println("SocketData1234: $data")

                try {
                    val postsResponse = Json.decodeFromString<PostsResponse>(data)
                    _posts.value = postsResponse.postCollection ?: emptyList()
                    preCacheVideos(postsResponse)
                } catch (e: Exception) {
                    println("❌ Failed to parse JsonElement: ${e.message}")
                }

        }
    }
    socket.connect()

error null
error123 Error
reconnect attempt 1
error null
error123 Error
reconnect attempt 2
error null
error123 Error
reconnect attempt 3

i am unable to connect to my socket in IOS app, inn android it is working fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions