Code Monkey home page Code Monkey logo

Comments (21)

bennyscripts avatar bennyscripts commented on May 11, 2024

Ok i made a way to log out by copying the log out btn from user settings onto the loading view.

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

So the error is not related to server folders, ill try my best to solve it but its here if anyone is able to help.

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

@bentettmar, these warnings are due to me trying out a performance optimization, and do not impact functionality (you can just ignore them, in my testing). Swiftcord simply ignores server folders, so that shouldn't cause problems. To help me debug this issue, could you send more of the logs?

Also, you might want to try the newly-created native-urlsession-websocket branch which contains fixes for the warnings, and potentially has performance increases. Reconnection is not implemented yet, so if you disconnect the Gateway will never reconnect until you restart Swiftcord.

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

It's quite puzzling that the socket is closing with code 1000, since discord close codes usually are in the range 400x. I'll need more of the log to debug this, up to and after the close code error. Please also try the new branch, that might be easier to debug

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

It closes after a while of receiving discord's gateway message events.
heres the full log: https://pastebin.com/R8NETuKW

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

I will try out the native-urlsession-websocket branch

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

It seems to me that the gateway is being terminated because no heartbeats were received within the tolerance. You could try the other branch, which might fix this issue.

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

After updating to the new branch, i get this error being spammed in the console.

<D> [DiscordGateway] Resume called
<E> [DiscordGateway] Connection error: Optional(Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected" UserInfo={NSErrorFailingURLStringKey=https://gateway.discord.gg/?v=9&encoding=json, NSErrorFailingURLKey=https://gateway.discord.gg/?v=9&encoding=json})

I did also enable incoming connections but that didnt seem to do anything.

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

Ok, I'm seeing a common trend of issues here: nothing is received by the WebSocket, so it eventually kills the connection.

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

What were the messages before that error gets spammed in the console?

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

I did also enable incoming connections but that didnt seem to do anything.

Was it not already enabled? If it wasn't, I think I see the issue now. But still, please send me the log before the error starts spamming.

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

Heres the full log: https://pastebin.com/XaWTLeHF
It also spams this as well:
image

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

It seems like the gateway is randomly disconnecting. Do you have a stable internet connection?

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

Yes, my internet is fine and i can connect to Discord's gateway because my bots run fine and i can load the original client.

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

Yeah, the spamming is a side-effect of my incorrect handling of close events. The only conclusion I can get is the websocket disconnects randomly, and without any reason. What you could try to do, is to log the receive closure to get a better idea of the messages coming in
Screen Shot 2022-04-13 at 6 07 08 PM

Screen Shot 2022-04-13 at 6 08 22 PM

Logging the reason and close code here can shed some light on the issue as well,

Screen Shot 2022-04-13 at 6 09 36 PM

And finally, removing the cases for .error, .cancelled and .binary should fix the spamming issue (but does not fix the root issue of the socket disconnecting)

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

Ok ill take a look at it next time i have time. Thanks for the input.

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

Ok, hopefully you can sort out this issue :D. This is a weird case I've never met before, after testing it on numerous accounts and different network conditions.

from swiftcord.

MontereySand avatar MontereySand commented on May 11, 2024

god I wish I knew I how to code, this stuff is awesome I'll pitch in during summer when school is over for sure! love your work

from swiftcord.

cryptoAlgorithm avatar cryptoAlgorithm commented on May 11, 2024

Hey, @bentettmar, I completely rewrote the underlying WebSocket wrapper class, which should hopefully increase its reliability. You could try pulling the latest commits from the native-urlsession-websocket branch and building it again, and seeing if the issue persists.

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

I pulled the native-urlsession-websocket branch but during build i get this error

error: Build input file cannot be found: '/Macintosh HD/Users/vinkwok/XcodeProjects/Swiftcord/Swiftcord/Utils/LoggerInit.swift' (in target 'Swiftcord' from project 'Swiftcord')

from swiftcord.

bennyscripts avatar bennyscripts commented on May 11, 2024

Fixed in discord.

from swiftcord.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.