Socket.io-client: "Unerwartetes Token

Erstellt am 14. Mai 2015  ·  5Kommentare  ·  Quelle: socketio/socket.io-client

Wenn ich die Client-Bibliothek wie folgt lade:

Alle 5 Kommentare

src="js/socket.io.js"

Es muss src="/socket.io/socket.io.js" sein

Ich bekomme den gleichen Fehler mit dieser HTML-Datei:

<!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>

Was mache ich falsch?

es funktioniert, wenn ich verwende:

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

Wo _ist_ die richtige URL?

Beim lokalen Aufrufen von socket.io.js funktionierte es, wenn ich browserify verwendete, um die richtigen erforderlichen Dateien zu kompilieren. Eine andere Möglichkeit besteht darin, die Bibliothek in _socket.io-client_ zu verwenden.

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen
bleepcoder.com verwendet öffentlich lizenzierte GitHub-Informationen, um Entwicklern auf der ganzen Welt Lösungen für ihre Probleme anzubieten. Wir sind weder mit GitHub, Inc. noch mit anderen Entwicklern affiliiert, die GitHub für ihre Projekte verwenden. Wir hosten keine der Videos oder Bilder auf unseren Servern. Alle Rechte gehören ihren jeweiligen Eigentümern.
Quelle für diese Seite: Quelle

Beliebte Programmiersprachen
Beliebte GitHub Projekte
Mehr GitHub Projekte

© 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.