SOLVED
How to auth to wasteof socketio?
Sample code maybe (js code also will be fine)
My current code: connects to API but idk where and how to authenticate (I have token/session)
import os
os.system("pip install python-socketio[client]")
os.system("clear")
import socketio
sio = socketio.Client()
@sio.event
def dsconnect(data):
print('I received a message!')
print(data)
@sio.on('updateMessageCount')
def on_message(data):
print('I received a message!')
print(data)
@sio.event
def connect():
print("I'm connected!")
#sio.emit('login', {'Authorization': api.token})
sio.connect("https://api.wasteof.money/")
if you use requests:
connect = requests.get('api.wasteof.money/messages', headers={'Authorization': api.token})
idk what to do for socket bc I’ve never used but the auth token needs to be in the header
so maybe
sio.connect('https://api.wasteof.money', headers={'Authorization': api.token})
idk python, but try
sio.connect("https://api.wasteof.money/", {
auth: {
token: "TOKEN_HERE"
}
})You can post in js too
const { io } = require(`socket.io-client`)
io(`https://api.wasteof.money`, {
auth: {
token: token
}
});Jeffalo just sent the same thing as you did. I think I cant translate to python :(
Iĺl try to translate to python, even though Idk python
Ok ty :P
Oh I’m dumb.. Thank you!! It worked!!!!
https://replit.com/@QuantumCodes/Wasteof-money-posting#main.py code
@non-biased-news @wynd @ankit_anmol you have to emit an “updateUser” message with your token like this:
(that’s what’s used for wasteof-client v3)
Also does anyone know how to send chat messages because I can’t figure out how to
I got it working without that
how
Jeffalo said me the same as wynd answered
https://beta.wasteof.money/posts/62a7c37b0cdad6f85160e6db
That link is for code
I have no idea how to use node.js, I use python.
What does that do?