GithubHelp home page GithubHelp logo

sss-says-snek / hisock Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 2.0 1.18 MB

A higher-level extension of the socket module, with simpler and more efficient usages

Home Page: https://hisock.readthedocs.io

License: MIT License

Python 100.00%
package python sockets

hisock's Introduction

Hey, I'm SSS-Says-Snek ๐Ÿ˜€

Just your nice, local snek, as well as your friendly neighborhood Pythonista. Been programming in Python since late 2017 :D

You can find me either chilling around in the Pygame Discord, programming, or playing some games.

Toolbelt

Goodbye, and have an okay day!

hisock's People

Contributors

dependabot[bot] avatar sss-says-snek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sheepy0125 gresm

hisock's Issues

BrokenPipeError in hisock's tictactoe server (while playing terminal client)

Describe the bug
After replaying a tic tac toe match, the server breaks with a BrokenPipeError. This is currently being under investigation; it is speculated to be caused by the client disconnection handling.

To Reproduce
Replay a tictactoe match (the first time, it works well)

NOTE: This bug seems to be present only while the opponents are both using the terminal client

[TODO] Blackify all files

What is needing to be done currently?
Currently, all files have different PEP8 conventions, because they've all been decided on my mood and how I was feeling to "obey PEP8" that day. So, with Black, the formatting would be much more regular, which is what we want.

Why aren't you doing it right now? >:(
I'm pretty lazy, plus I'm studying electronics rn.

10054 error for long-running client-server connections

Describe the bug
I honestly have no clue what it is (even when going on SO), hisock just throws that exception for long running client-server connections.

To Reproduce
I don't know, start a connection and then sleep for 8 hours?

Expected behavior
Obviously, no exception

[TODO] Release 1.1

What is needing to be done currently?
... Releasing version 1.1. Was gonna be 1.0.1, but with the addition of a couple funcs, I think it's worthy to be a minor version rather than a micro version.

Why aren't you doing it right now? >:(
I'm pretty lazy.

Feature Request: Make it so that Snek can only do 1 issue at a time

Is your feature request related to a problem? Please describe.
Like, he currently as the time of writing has 7 issues open. Be clear on one thing, smh

Describe the solution you'd like
That he be removed from the hisock development "team"

Describe alternatives you've considered
An alternative is for him to leave Alabama

Why do you want to add this feature?
shi de

Additional context
image

Finish 3.0

๐Ÿ™๐Ÿฝ

I should also probably add better docs too

Improve type HINTING in codebase

Is your feature request related to a problem? Please describe.
I mean, I regularly add type hints to the hisock functions, classes, etc. However, sometimes, they're not that detailed (E.g a dict without specifying keys and values).

Describe the solution you'd like
Add better type hints, duh. (dict -> dict[str, int])

Describe alternatives you've considered
Comments go brr

Why do you want to add this feature?
To improve "readability". This might be debated, since some people think type hints are good while others think not. The main point is to improve the user's experience with hisock, particularly the user's IDE.

Additional context
Haha avaxar I'm opening another issue

`set_reserved_function_config()` method for HiSockClient and HiSockServer

Is your feature request related to a problem? Please describe.
When I saw sheepy use hisock, he used his implementation of the leave reserved function, because he sent some extra data. So, I realized that the functions would be useless to people who want to have their custom data sent on a particular reserved function event.

Describe the solution you'd like
So, I plan to add this method so that users can specify the data they want to send whenever a reserved function is triggered. The usage would probably be like server.set_reserved_function_config('leave', ['clt_info', 'my_data', 'more_data'])

Add async support for `HiSockClient` and `HiSockServer`

Is your feature request related to a problem? Please describe.
Sometimes, async programming could be better than a multithreaded solution. So, I'm planning to add an AsyncHiSockServer and AsyncHiSockClient class, as well as the functions to create an instance of them, soon.

Describe alternatives you've considered
Well, we already have multithreaded servers and clients, but I think it'd be the icing on the cake to have hisock be asynchronous.

Additional context
Stackoverflow async socket

Add HiSockGroup, along with new group submodule

Currently, groups only have the advantage of sending messages to a group of clients, and identifying them easily. However, this issue expands on groups, adding such things as a message cache.

IMPORT ERROR (URGENT)

Describe the bug
IMPORT ERRORS IN HISOCK DUE TO EXAMPLES - I AM WORKING ON IT

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Add keepalive

A keepalive signal would be pulsed every minute from the server to every client. The client has 30 seconds to respond, or else they will be declared dead and be disconnected from the server. This ensures that no already dead client would be left in the server for too long.

I actually already started working on this, so it will just take ~10 or so hours for it to finally be added to hisock.

IPv6 support for hisock

Is your feature request related to a problem? Please describe.
We are running out of IPv4 addresses in the world. Pretty soon, we would have to transition to a different protocol.

Describe the solution you'd like
If hisock supports IPv6, then we would in a way help prepare for the future.

Describe alternatives you've considered
No other alternatives.

Keepalive doesn't actually work (wow!!)

No way hisock activity after a year

Describe the bug
I don't know if we ever tested the keepalive functionality, but while I was working on a hisock VoIP app, I accidently didn't start my client, and the server emitted a ValueError. More info is on discord.

To Reproduce
Steps to reproduce the behavior:

  1. Start server
  2. Make client connect to server but do NOT start it
  3. Wait

Expected behavior
No error

Screenshots
image

Additional context
Looks like while the keepalive's disconnecting the client, the server also sees that it's closed and disconnects it too. Goofy race condition

Add a "cache" of previous messages (`HiSockClient` and variants)

Describe the feature
Sometimes, it may be useful to know previous messages of what the client has received. So, I propose to add some sort of "cache" that appends each message (and header) to a dictionary. Using a method, users can then get previous messages.

Additional context
I got this idea after struggling with a MemoryError for sockets, when the header did not send out, and instead, the first 16 bytes of the data was set as the header. The data just so happened to be a large prime number for cryptography, so... the huge 16 digit number caused a MemoryError

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.