Socket.io-client: "Jeton inattendu

Créé le 14 mai 2015  ·  5Commentaires  ·  Source: socketio/socket.io-client

Lorsque je charge la bibliothèque cliente comme suit :

Tous les 5 commentaires

src="js/socket.io.js"

Il doit être src="/socket.io/socket.io.js"

J'obtiens la même erreur en utilisant ce fichier html :

<!doctype html>
<html lang="en">
<head>
  <!-- The first thing in any HTML file should be the charset -->
  <meta charset="utf-8">
  <!-- Make the page mobile compatible -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Allow installing the app to the homescreen -->
  <link rel="manifest" href="manifest.json">
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css">
  <meta name="mobile-web-app-capable" content="yes">
  <title>AP Flora</title>
</head>
<body>
<!-- The app hooks into this div -->
<div id="app"></div>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- A lot of magic happens in this file. HtmlWebpackPlugin automatically includes all assets (e.g. bundle.js, main.css) with the correct HTML tags, which is why they are missing in this HTML file. Don't add any assets here! (Check out webpackconfig.js if you want to know more) -->
<script src="/socket.io/socket.io.js"></script>
<script>
  const socket = io()
  console.log(`socket:`, socket)
</script>
</body>
</html>

Qu'est-ce que je fais mal?

ça marche quand j'utilise :

<script src="https://cdn.socket.io/socket.io-1.4.0.js"></script>

Quelle _est_ la bonne URL ?

En appelant socket.io.js localement, cela a fonctionné lorsque j'utilise browserify pour compiler les fichiers requis corrects. Une autre façon est d'utiliser la bibliothèque à l'intérieur de _socket.io-client_

Cette page vous a été utile?
0 / 5 - 0 notes
bleepcoder.com utilise des informations sous licence publique GitHub pour fournir aux développeurs du monde entier des solutions à leurs problèmes. Nous ne sommes pas affiliés à GitHub, Inc. ni à aucun développeur qui utilise GitHub pour ses projets. Nous n'hébergeons aucune des vidéos ou images sur nos serveurs. Tous les droits appartiennent à leurs propriétaires respectifs.
Source pour cette page: Source

Langages de programmation populaires
Projets GitHub populaires
Plus de projets GitHub

© 2024 bleepcoder.com - Contact
Made with in the Dominican Republic.
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.