PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

Websocket is not working!

Open ghost opened this issue 10 years ago • 5 comments

Expected Behavior

I wanted to get WebSocket be activated for checking the bot trend by an app called "Pokemon Bot Visualizer 1.0.9" for Windows.

Actual Behavior

WebSocket doesn't works, I have an nmap scan and I don't found the service. I put the nmap output in the "Output when issue occurred" section.

Your FULL config.json (remove your username, password, gmapkey and any other private info)

{ "auth_service": "private", "username": "private", "password": "private", "location": "private", "gmapkey": "private", "encrypt_location": "", "websocket_server": true, "heartbeat_threshold": 10, "tasks": [ { "type": "HandleSoftBan" }, { "type": "SleepSchedule", "config": { "enabled": false, "time": "22:54", "duration":"7:46", "time_random_offset": "00:24", "duration_random_offset": "00:43", "wake_up_at_location": "" } }, { "type": "RandomPause", "config": { "enabled": false, "min_duration": "00:00:10", "max_duration": "00:10:00", "min_interval": "00:10:00", "max_interval": "02:00:00" } }, { "type": "CompleteTutorial", "config": { "enabled": false, "// set a name": "", "nickname": "" } }, { "type": "CollectLevelUpReward" }, { "type": "IncubateEggs", "config": { "longer_eggs_first": true, "min_interval": 120 } }, { "type": "UpdateLiveStats", "config": { "enabled": true, "min_interval": 10, "stats": ["username", "uptime", "stardust_earned", "xp_earned", "xp_per_hour", "stops_visited"], "terminal_log": true, "terminal_title": true } }, { "type": "UpdateLiveInventory", "config": { "enabled": true, "min_interval": 120, "show_all_multiple_lines": true, "items": ["pokemon_bag", "space_info", "pokeballs", "greatballs", "ultraballs", "razzberries", "luckyegg"] } }, { "type": "TransferPokemon", "config": { "min_free_slot": 5, "transfer_wait_min": 1, "transfer_wait_max": 4 } }, { "type": "NicknamePokemon", "config": { "enabled": false, "nickname_above_iv": 0.9, "nickname_template": "{iv_pct}_{iv_ads}" } }, { "type": "EvolvePokemon", "config": { "evolve_all": "true", "first_evolve_by": "cp", "evolve_above_cp": 500, "evolve_above_iv": 0.8, "logic": "or", "evolve_speed": 20, "use_lucky_egg": true } }, { "type": "RecycleItems", "config": { "min_empty_space": 15, "max_balls_keep": 150, "max_potions_keep": 50, "max_berries_keep": 70, "max_revives_keep": 70, "item_filter": { "Pokeball": { "keep" : 100 }, "Potion": { "keep" : 10 }, "Super Potion": { "keep" : 20 }, "Hyper Potion": { "keep" : 30 }, "Revive": { "keep" : 30 }, "Razz Berry": { "keep" : 100 } }, "recycle_wait_min": 1, "recycle_wait_max": 4 } }, { "type": "CatchPokemon", "config": { "catch_visible_pokemon": true, "catch_lured_pokemon": true, "min_ultraball_to_keep": 5, "berry_threshold": 0.35, "vip_berry_threshold": 0.9, "catch_throw_parameters": { "excellent_rate": 0.1, "great_rate": 0.5, "nice_rate": 0.3, "normal_rate": 0.1, "spin_success_rate" : 0.6, "hit_rate": 0.75 }, "catch_simulation": { "flee_count": 3, "flee_duration": 2, "catch_wait_min": 2, "catch_wait_max": 6, "berry_wait_min": 2, "berry_wait_max": 3, "changeball_wait_min": 2, "changeball_wait_max": 3 } } }, { "type": "SpinFort", "config": { "spin_wait_min": 3, "spin_wait_max": 5 } }, { "type": "MoveToFort", "config": { "lure_attraction": true, "lure_max_distance": 2000, "walker": "StepWalker" } }, { "type": "FollowSpiral", "config": { "diameter": 8, "step_size": 140 } } ], "map_object_cache_time": 5, "forts": { "avoid_circles": true, "max_circle_size": 50, "cache_recent_forts": true }, "pokemon_bag": { "// if 'show_at_start' is true, it will log all the pokemons in the bag (not eggs) at bot start": {}, "show_at_start": true, "// if 'show_count' is true, it will show the amount of each pokemon (minimum 1)": {}, "show_count": false, "// if 'show_candies' is true, it will show the amount of candies for each pokemon": {}, "show_candies": false, "// 'pokemon_info' parameter define which info to show for each pokemon": {}, "// the available options are": {}, "// ['cp', 'iv_ads', 'iv_pct', 'ivcp', 'ncp', 'level', 'hp', 'moveset', 'dps']": {}, "pokemon_info": ["cp", "iv_pct"] }, "walk_max": 19.99, "walk_min": 18.99, "alt_min": 500, "alt_max": 1000, "gps_default_altitude": 8.0, "replicate_gps_xy_noise": true, "replicate_gps_z_noise": true, "gps_xy_noise_range": 0.000125, "gps_z_noise_range": 12.5, "debug": false, "test": false, "health_record": true, "location_cache": true, "distance_unit": "km", "reconnecting_timeout": 15, "logging_color": true, "daily_catch_limit": 1000, "catch": { "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"}, "// Example of always catching Rattata:": {}, "// Rattata": { "always_catch" : true } }, "release": { "any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"}, "// Example of always releasing Rattata:": {}, "// Rattata": {"always_release": true}, "// Example of keeping 3 stronger (based on CP) Pidgey:": {}, "// Pidgey": {"keep_best_cp": 3}, "// Example of keeping 2 best (based on IV) Zubat:": {}, "// Zubat": {"keep_best_iv": 2}, "// Also, it is working with any": {}, "// any": {"keep_best_iv": 3}, "// Example of keeping the 2 strongest (based on CP) and 3 best (based on IV) Zubat:": {}, "// Zubat": {"keep_best_cp": 2, "keep_best_iv": 3}, "// Example of custom order of static criterion": {}, "// Zubat": {"keep_best_custom": "iv, cp, hp_max", "amount":2} }, "vips" : { "Any pokemon put here directly force to use Berry & Best Ball to capture, to secure the capture rate!": {}, "any": {"catch_above_cp": 1200, "catch_above_iv": 0.9, "logic": "or" }, "Lapras": {}, "Moltres": {}, "Zapdos": {}, "Articuno": {},

    "// S-Tier pokemons (if pokemon can be evolved into tier, list the representative)": {},
    "Mewtwo": {},
    "Dragonite": {},
    "Snorlax": {},
    "// Mew evolves to Mewtwo": {},
    "Mew": {},
    "Arcanine": {},
    "Vaporeon": {},
    "Gyarados": {},
    "Exeggutor": {},
    "Muk": {},
    "Weezing": {},
    "Flareon": {}
}

}

Output when issue occurred

No output, the service is not working.

Nmap output:

root@vps19533:~/PokemonGo-Bot-master# nmap 127.0.0.1 -p1-65535 -sV --version-all -A -O --privileged

Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-23 10:46 EDT Nmap scan report for localhost.localdomain (127.0.0.1) Host is up (0.000031s latency). Not shown: 65532 closed ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 6.7p1 Debian 5+deb8u2 (protocol 2.0) |_ssh-hostkey: ERROR: Script execution failed (use -d to debug) 25/tcp open smtp Postfix smtpd |_smtp-commands: UNKNOWN, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN, | ssl-cert: Subject: commonName=localhost.localdomain | Not valid before: 2016-06-21T14:51:43+00:00 |_Not valid after: 2026-06-19T14:51:43+00:00 |_ssl-date: 1992-05-24T15:38:18+00:00; -24y90d23h08m14s from local time. 80/tcp open http Apache httpd 2.4.10 ((Debian)) |_http-title: Index of / No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ). TCP/IP fingerprint: OS:SCAN(V=6.47%E=4%D=8/23%OT=22%CT=1%CU=38135%PV=N%DS=0%DC=L%G=Y%TM=57BC61C OS:8%P=x86_64-pc-linux-gnu)SEQ(SP=104%GCD=1%ISR=10D%TI=Z%CI=Z%II=I%TS=A)OPS OS:(O1=MFFD7ST11NW7%O2=MFFD7ST11NW7%O3=MFFD7NNT11NW7%O4=MFFD7ST11NW7%O5=MFF OS:D7ST11NW7%O6=MFFD7ST11)WIN(W1=FFCB%W2=FFCB%W3=FFCB%W4=FFCB%W5=FFCB%W6=FF OS:CB)ECN(R=Y%DF=Y%T=40%W=FFD7%O=MFFD7NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A OS:=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0% OS:Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S= OS:A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R= OS:Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N% OS:T=40%CD=S)

Network Distance: 0 hops Service Info: Host: UNKNOWN; OS: Linux; CPE: cpe:/o:linux:linux_kernel

OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 19.28 seconds

Steps to Reproduce

Just set the websocket setting to true.

Other Information

OS:

Output of uname -a: Linux vps19533 2.6.32-042stab113.11 #1 SMP Fri Dec 18 17:32:04 MSK 2015 x86_64 GNU/Linux (Debian 8.0 64 Bit)

Git Commit: fatal: Not a git repository (or any of the parent directories): .git

Python Version: Python 2.7.9

Any other relevant files/configs (eg: path files)

Short Description

How I can get WebSocket to work? It's a bug or a simply configuration error mistake?

Possible solution

I don't really know.

How it would help others

It would help other to monitor their bot.

ghost avatar Aug 23 '16 15:08 ghost

have you started the bot like: pokecli.py -wss true -ws "localhost:4000" -wsr true

Cetino avatar Aug 23 '16 15:08 Cetino

and modify your runner.py from

self.host, port_str = url.split(':') to self.host, port_str = url.split(':') self.host = "0.0.0.0"

making the server listening just on localhost doesnt make any sense when you want to access the socket_io from external. The Devs should realy fix this. Take a look at my issue: https://github.com/PokemonGoF/PokemonGo-Bot/issues/3925

Cetino avatar Aug 23 '16 15:08 Cetino

No need to modify runner.py - just use -ws "0.0.0.0:4000" instead.

glenncampioni avatar Aug 23 '16 16:08 glenncampioni

Starting the server on 0.0.0.0 will result in an error. 2016-08-23 18:44:11,351 [socketIO-client] [WARNING] 0.0.0.0:4000/socket.io [engi ne.io waiting for connection] HTTPConnectionPool(host='0.0.0.0', port=4000): Max retries exceeded with url: /socket.io/?EIO=3&transport=polling&t=1471970651351- 0 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConne ction object at 0x00000000074495F8>: Failed to establish a new connection: [Errn o 10049] WSAEADDRNOTAVAIL',))

the bot tries to connect on 0.0.0.0 to the Server...

Cetino avatar Aug 23 '16 16:08 Cetino

I see, This whole thing needs to be rewritten tbh..

glenncampioni avatar Aug 23 '16 16:08 glenncampioni