Socket.io-client: "رمز غير متوقع

تم إنشاؤها على ١٤ مايو ٢٠١٥  ·  5تعليقات  ·  مصدر: socketio/socket.io-client

عندما أقوم بتحميل مكتبة العميل على النحو التالي:

ال 5 كومينتر

src = "js / socket.io.js"

يجب أن يكون src="/socket.io/socket.io.js"

أحصل على نفس الخطأ باستخدام ملف 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>

ما الخطأ الذي افعله؟

يعمل عندما أستخدم:

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

ما هو _is_ عنوان url الصحيح؟

عند استدعاء socket.io.js محليًا ، فقد نجح عندما أستخدم browserify لتجميع الملفات المطلوبة الصحيحة. طريقة أخرى هي استخدام lib داخل _socket.io-client_

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات
يستخدم موقع bleepcoder.com معلومات GitHub المرخصة بشكل عام لتزويد المطورين حول العالم بحلول لمشاكلهم. نحن لسنا تابعين لشركة GitHub، Inc. أو مع أي مطورين يستخدمون GitHub لمشاريعهم. نحن لا نستضيف أيًا من مقاطع الفيديو أو الصور على خوادمنا. جميع الحقوق تنتمي إلى أصحابها.
مصدر هذه الصفحة: مصدر

لغات البرمجة الشعبية
مشاريع GitHub الشعبية
المزيد من مشاريع 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.