{"id":22283738,"url":"https://github.com/veaba/socket.io-server-python","last_synced_at":"2025-03-25T19:51:30.359Z","repository":{"id":104582240,"uuid":"224365061","full_name":"veaba/socket.io-server-python","owner":"veaba","description":"为啥没人搞好一点的Python 版本的socket.io呢？","archived":false,"fork":false,"pushed_at":"2019-11-27T14:29:55.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T17:39:38.271Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/veaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-27T06:56:08.000Z","updated_at":"2019-11-27T14:29:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"43ba9d7f-b3c2-4db6-a68a-6f530d6a4e46","html_url":"https://github.com/veaba/socket.io-server-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veaba%2Fsocket.io-server-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veaba%2Fsocket.io-server-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veaba%2Fsocket.io-server-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veaba%2Fsocket.io-server-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veaba","download_url":"https://codeload.github.com/veaba/socket.io-server-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245535427,"owners_count":20631293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T16:41:57.400Z","updated_at":"2025-03-25T19:51:30.334Z","avatar_url":"https://github.com/veaba.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 自制的python版本的socket.io\n\n\u003e 你们为什么不出个python 版本代号666的socket.io呢？？ 非得让我喷！！气人\n\n\n## 开发节奏\n\n- 先看engine.io 源码和了解背后逻辑\nhttps://github.com/veaba/engine.io\n\n\n- socket.io 协议 https://github.com/socketio/engine.io-protocol\n\n- engine.io-pasrser https://github.com/learnboost/engine.io-parser\n\n- engine.io-client https://github.com/learnboost/engine.io-client\n\n- engine.io https://github.com/learnboost/engine.io\n\n- 再看socket.io 源码和了解背后设计逻辑\n\n- 再了解node 版本的socket.io \n\n- 接下来是python 的http\n\n- 以及python 的socket\n\n- 还有 python 的websocket\n\n- HTTP 协议 HTTP1.1 HTTP2.0  HTTPS socket\n\n- 利用Python 搭建HttpServer https://www.jianshu.com/p/279473392f38\n\n## python 创建基本的http服务\n\n```python\nfrom http.server import BaseHTTPRequestHandler,HTTPServer\n\nPORT_NUMBER = 8000\n\n#This class will handles any incoming request from\n#the browser \nclass myHandler(BaseHTTPRequestHandler):\n\n    #Handler for the GET requests\n    def do_GET(self):\n        print(111,self)\n        self.send_response(200)\n        self.send_header('Content-type','text/html')\n        self.end_headers()\n        # Send the html message\n        self.wfile.write(bytes(\"Hello World !\",encoding='utf-8'))\n        return\n\ntry:\n    server = HTTPServer(('', PORT_NUMBER), myHandler)\n    print('Started httpserver on port ' , PORT_NUMBER)\n\n    #Wait forever for incoming htto requests\n    server.serve_forever()\n\nexcept KeyboardInterrupt:\n    print('^C received, shutting down the web server')\n    server.socket.close()\n```\n\n## node 版本的socket.io方法\n\n- checkRequest: [Function],\n- serveClient: [Function],\n- set: [Function],\n- checkNamespace: [Function],\n- path: [Function],\n- adapter: [Function],\n- origins: [Function],\n- attach: [Function],\n- listen: [Function],\n- initEngine: [Function],\n- attachServe: [Function],\n- serve: [Function],\n- serveMap: [Function],\n- bind: [Function],\n- onconnection: [Function],\n- of: [Function],\n- close: [Function],\n- setMaxListeners: [Function],\n- getMaxListeners: [Function],\n- emit: [Function],\n- addListener: [Function],\n- on: [Function],\n- prependListener: [Function],\n- once: [Function],\n- prependOnceListener: [Function],\n- removeListener: [Function],\n- off: [Function],\n- removeAllListeners: [Function],\n- listeners: [Function],\n- rawListeners: [Function],\n- listenerCount: [Function],\n- eventNames: [Function],\n-  to: [Function],\n- in: [Function],\n- use: [Function],\n- send: [Function],\n- write: [Function],\n- clients: [Function],\n- compress: [Function],\n- binary: [Function] }\n\n## 原生python 内置的socket\n\n- AF_APPLETALK\n- AF_DECnet\n- AF_INET\n- AF_INET6\n- AF_IPX\n- AF_IRDA\n- AF_SNA\n- AF_UNSPEC\n- AI_ADDRCONFIG\n- AI_ALL\n- AI_CANONNAME\n- AI_NUMERICHOST\n- AI_NUMERICSERV\n- AI_PASSIVE\n- AI_V4MAPPED\n- AddressFamily\n- AddressInfo\n- CAPI\n- EAGAIN\n- EAI_AGAIN\n- EAI_BADFLAGS\n- EAI_FAIL\n- EAI_FAMILY\n- EAI_MEMORY\n- EAI_NODATA\n- EAI_NONAME\n- EAI_SERVICE\n- EAI_SOCKTYPE\n- EBADF\n- EWOULDBLOCK\n- INADDR_ALLHOSTS_GROUP\n- INADDR_ANY\n- INADDR_BROADCAST\n- INADDR_LOOPBACK\n- INADDR_MAX_LOCAL_GROUP\n- INADDR_NONE\n- INADDR_UNSPEC_GROUP\n- IPPORT_RESERVED\n- IPPORT_USERRESERVED\n- IPPROTO_ICMP\n- IPPROTO_IP\n- IPPROTO_RAW\n- IPPROTO_TCP\n- IPPROTO_UDP\n- IPV6_CHECKSUM\n- IPV6_DONTFRAG\n- IPV6_HOPLIMIT\n- IPV6_HOPOPTS\n- IPV6_JOIN_GROUP\n- IPV6_LEAVE_GROUP\n- IPV6_MULTICAST_HOPS\n- IPV6_MULTICAST_IF\n- IPV6_MULTICAST_LOOP\n- IPV6_PKTINFO\n- IPV6_RECVRTHDR\n- IPV6_RECVTCLASS\n- IPV6_RTHDR\n- IPV6_TCLASS\n- IPV6_UNICAST_HOPS\n- IPV6_V6ONLY\n- IP_ADD_MEMBERSHIP\n- IP_DROP_MEMBERSHIP\n- IP_HDRINCL\n- IP_MULTICAST_IF\n- IP_MULTICAST_LOOP\n- IP_MULTICAST_TTL\n- IP_OPTIONS\n- IP_RECVDSTADDR\n- IP_TOS\n- IP_TTL\n- IntEnum\n- IntFlag\n- MSG_BCAST\n- MSG_CTRUNC\n- MSG_DONTROUTE\n- MSG_MCAST\n- MSG_OOB\n- MSG_PEEK\n- MSG_TRUNC\n- MSG_WAITALL\n- MsgFlag\n- NI_DGRAM\n- NI_MAXHOST\n- NI_MAXSERV\n- NI_NAMEREQD\n- NI_NOFQDN\n- NI_NUMERICHOST\n- NI_NUMERICSERV\n- RCVALL_MAX\n- RCVALL_OFF\n- RCVALL_ON\n- RCVALL_SOCKETLEVELONLY\n- SHUT_RD\n- SHUT_RDWR\n- SHUT_WR\n- SIO_KEEPALIVE_VALS\n- SIO_LOOPBACK_FAST_PATH\n- SIO_RCVALL\n- SOCK_DGRAM\n- SOCK_RAW\n- SOCK_RDM\n- SOCK_SEQPACKET\n- SOCK_STREAM\n- SOL_IP\n- SOL_SOCKET\n- SOL_TCP\n- SOL_UDP\n- SOMAXCONN\n- SO_ACCEPTCONN\n- SO_BROADCAST\n- SO_DEBUG\n- SO_DONTROUTE\n- SO_ERROR\n- SO_EXCLUSIVEADDRUSE\n- SO_KEEPALIVE\n- SO_LINGER\n- SO_OOBINLINE\n- SO_RCVBUF\n- SO_RCVLOWAT\n- SO_RCVTIMEO\n- SO_REUSEADDR\n- SO_SNDBUF\n- SO_SNDLOWAT\n- SO_SNDTIMEO\n- SO_TYPE\n- SO_USELOOPBACK\n- SocketIO\n- SocketKind\n- SocketType\n- TCP_MAXSEG\n- TCP_NODELAY\n- _GLOBAL_DEFAULT_TIMEOUT\n- _GiveupOnSendfile\n- _LOCALHOST\n- _LOCALHOST_V6\n- __all__\n- __builtins__\n- __cached__\n- __doc__\n- __file__\n- __loader__\n- __name__\n- __package__\n- __spec__\n- _blocking_errnos\n- _intenum_converter\n- _realsocket\n- _socket\n- create_connection\n- dup\n- errno\n- error\n- errorTab\n- fromfd\n- fromshare\n- gaierror\n- getaddrinfo\n- getdefaulttimeout\n- getfqdn\n- gethostbyaddr\n- gethostbyname\n- gethostbyname_ex\n- gethostname\n- getnameinfo\n- getprotobyname\n- getservbyname\n- getservbyport\n- has_ipv6\n- herror\n- htonl\n- htons\n- inet_aton\n- inet_ntoa\n- inet_ntop\n- inet_pton\n- io\n- ntohl\n- ntohs\n- os\n- selectors\n- setdefaulttimeout\n- socket\n- socketpair\n- sys\n- timeout","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveaba%2Fsocket.io-server-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveaba%2Fsocket.io-server-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveaba%2Fsocket.io-server-python/lists"}