Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it useful to convert the jbnc code into a class? #74

Open
Madriix opened this issue Apr 17, 2024 · 8 comments
Open

Is it useful to convert the jbnc code into a class? #74

Madriix opened this issue Apr 17, 2024 · 8 comments

Comments

@Madriix
Copy link
Collaborator

Madriix commented Apr 17, 2024

Hi,

Do you know if it would be useful for me to try converting the jbnc code into a class,

class jBNC {
  constructor() {
    // Track IRC (Server) Connections
    this.connections = {};
  }

  init(){
  }

  doServer() {
  }

  clientReconnect(socket) {
  }

  clientConnect(socket) {
  }


}

new jBNC();

or is it pointless ?

@realrasengan
Copy link
Collaborator

I'd say generally it's always good to use classes because it makes code more manageable. Helps to debug issues as well.

It would make sense to further breakdown (e.g., Client class, PreClient class, IRCConnection class, BNC class, etc. imho) ;o

@Madriix
Copy link
Collaborator Author

Madriix commented Apr 17, 2024

Oh, I see, it would definitely make a good thing. It takes hours, constantly editing.

@Madriix Madriix closed this as completed Apr 17, 2024
@Madriix Madriix reopened this Apr 17, 2024
@Madriix
Copy link
Collaborator Author

Madriix commented Apr 18, 2024

@realrasengan I've adapted the code to be within classes : https://github.com/Madriix/jbnctest It has been tested locally on my PC with Node.js, and it seems to work well. However, I haven't tested it with a second user using a different nickname. I'll need to try that. If it works, I'll deploy it on the site for a few minutes or hours initially. If there are no issues, I'll leave it online until a problem arises.

@realrasengan
Copy link
Collaborator

That's really cool! :)

@Madriix
Copy link
Collaborator Author

Madriix commented Apr 18, 2024

@realrasengan I deployed it to production, but it was immediately shut down. I reverted to the previous version. There's an issue where all users are still sending messages twice (from their end), but the recipient only receives them once. I can't seem to pinpoint the problem.

@Madriix
Copy link
Collaborator Author

Madriix commented Apr 18, 2024

The issue no longer occurs when modifying it like this : https://github.com/Madriix/jbnctest/commit/5cb44655367475b2132a4dcf30c918abb7786900

EDIT: I restored, I just replaced this with socket: https://github.com/Madriix/jbnctest/commit/815123dfdd47a5d9aeaa1d8e26eaa5012b3490b5

@Madriix
Copy link
Collaborator Author

Madriix commented Apr 18, 2024

@realrasengan The JBNC classes have been running smoothly via Putty since 7:00 PM. It's almost midnight, with 205 users connected and the bouncetimeout set to 60 minutes, and it still hasn't crashed. Should I send a pull request?

@realrasengan
Copy link
Collaborator

Sounds good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants