当前位置: 首页 > news >正文

制作销售网站查看网站被恶意镜像

制作销售网站,查看网站被恶意镜像,番禺区网站建设公司,外贸公司取名字大全集前端代码 function initWebSocket() {if (typeof WebSocket undefined) {console.log(您的浏览器不支持WebSocket);} else {console.log(您的浏览器支持WebSocket);//实现化WebSocket对象#xff0c;指定要连接的服务器地址与端口 建立连…前端代码 function initWebSocket() {if (typeof WebSocket undefined) {console.log(您的浏览器不支持WebSocket);} else {console.log(您的浏览器支持WebSocket);//实现化WebSocket对象指定要连接的服务器地址与端口 建立连接//等同于socket new WebSocket(ws://localhost:8083/checkcentersys/websocket/20);var wsPathStr wsPath uuid;console.log(uuid22: uuid);socket new WebSocket(wsPathStr);//打开事件socket.onopen function () {console.log(Socket 已打开);socket.send(这是来自客户端的消息 location.href new Date());};//获得消息事件socket.onmessage function (msg) {// debugger;console.log(msg.data);var data JSON.parse(msg.data);if (data.code 200) {alert(登录成功);//这里存放自己业务需要的数据。怎么放自己看window.sessionStorage.uuid uuid;window.sessionStorage.userId data.userId;window.sessionStorage.projId data.projId;window.location.href pages/upload.html;} else {//如果过期了关闭连接、重置连接、刷新二维码// socket.close();// initQrImg();debugger;let path2 getQrPath2 / uuid;axios.get(path2, {params: { dd: cc },}).then(function (success) {console.log(成功);},function (fail) {console.log(失败);}).catch(function (error) {console.log(异常);});}//发现消息进入 开始处理前端触发逻辑};//关闭事件socket.onclose function () {console.log(Socket已关闭);};//发生了错误事件socket.onerror function () {alert(Socket发生了错误);//此时可以尝试刷新页面};}后端Java代码 package com.example.poi.utils;import cn.hutool.json.JSONObject; import cn.hutool.log.Log; import cn.hutool.log.LogFactory; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; import org.springframework.web.socket.server.standard.ServerEndpointExporter;import javax.websocket.*; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; import java.io.IOException; import java.util.concurrent.CopyOnWriteArraySet;/*** Author xu* create 2023/7/21 19*/ ServerEndpoint(/websocket/{sid}) Component public class WebSocketServer {static Log log LogFactory.get(WebSocketServer.class);//静态变量用来记录当前在线连接数。应该把它设计成线程安全的。private static int onlineCount 0;//concurrent包的线程安全Set用来存放每个客户端对应的MyWebSocket对象。private static CopyOnWriteArraySetWebSocketServer webSocketSet new CopyOnWriteArraySetWebSocketServer();//与某个客户端的连接会话需要通过它来给客户端发送数据private Session session;//接收sidprivate String sid;/*** 连接建立成功调用的方法** param session* param sid*/OnOpenpublic void onOpen(Session session,PathParam(sid) String sid) {this.session session;webSocketSet.add(this); //加入set中addOnlineCount(); //在线数加1log.info(有新窗口开始监听:sid,当前在线人数为 getOnlineCount());this.sidsid;/*try {sendMessage(连接成功);} catch (IOException e) {log.error(websocket IO异常);}*/}/*** 连接关闭调用的方法*/OnClosepublic void onClose() {webSocketSet.remove(this); //从set中删除subOnlineCount(); //在线数减1log.info(有一连接关闭当前在线人数为 getOnlineCount());}/*** 收到客户端消息后调用的方法* 客户端发送过来的消息* param message* param session*/OnMessagepublic void onMessage(String message, Session session) {log.info(收到来自窗口sid的信息:message);//群发消息for (WebSocketServer item : webSocketSet) {try {JSONObject jsonObject new JSONObject();jsonObject.put(name,张三);jsonObject.put(code,2001);jsonObject.put(userId,16);jsonObject.put(projId,200);item.sendMessage(jsonObject.toString());} catch (IOException e) {e.printStackTrace();}}}/**** param session* param error*/OnErrorpublic void onError(Session session, Throwable error) {log.error(发生错误);error.printStackTrace();}/*** 实现服务器主动推送* param message* throws IOException*/public void sendMessage(String message) throws IOException {this.session.getBasicRemote().sendText(message);}/*** 发送消息* param message* param sid* throws IOException*/public static void sendInfo(String message,PathParam(sid) String sid) throws IOException {log.info(推送消息到窗口sid推送内容:message);for (WebSocketServer item : webSocketSet) {try {//这里可以设定只推送给这个sid的为null则全部推送if(sid null) {item.sendMessage(message);}else if(item.sid.equals(sid)){item.sendMessage(message);}} catch (IOException e) {continue;}}}public static synchronized int getOnlineCount() {return onlineCount;}public static synchronized void addOnlineCount() {WebSocketServer.onlineCount;}public static synchronized void subOnlineCount() {WebSocketServer.onlineCount--;}/**必须要有这个bean才能生效使用webSocketServer*/Beanpublic ServerEndpointExporter serverEndpointExporter() {return new ServerEndpointExporter();}}pom dependencygroupIdcom.baomidou/groupIdartifactIdmybatis-plus-boot-starter/artifactIdversion3.5.1/version/dependencydependencygroupIdmysql/groupIdartifactIdmysql-connector-java/artifactIdversion8.0.13/version/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdcn.hutool/groupIdartifactIdhutool-all/artifactIdversion5.7.10/version/dependencydependencygroupIdcom.google.zxing/groupIdartifactIdcore/artifactIdversion3.4.1/version/dependencydependencygroupIdcommons-lang/groupIdartifactIdcommons-lang/artifactIdversion2.6/version/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-websocket/artifactId/dependencydependencygroupIdorg.projectlombok/groupIdartifactIdlombok/artifactIdversion1.18.12/version/dependency生成二维码 //获取登录二维码、放入Token//CrossOriginRequestMapping(value /getLoginQr ,method RequestMethod.GET)public void createCodeImg(HttpServletRequest request, HttpServletResponse response){response.setHeader(Pragma, No-cache);response.setHeader(Cache-Control, no-cache);response.setDateHeader(Expires, 0);response.setContentType(image/jpeg);try {//这里没啥操作 就是生成一个UUID插入 数据库的表里//String uuid userService.createQrImg();String uuid jdhasndi452iiwn11;response.addHeader(uuid, uuid);response.addHeader(Access-Control-Expose-Headers, uuid);response.addHeader(Access-Control-Allow-Origin, *);// 这里是开源工具类 hutool里的QrCodeUtil// 网址http://hutool.mydoc.io/QrCodeUtil.generate(uuid, 300, 300, jpg,response.getOutputStream());System.out.println(**);} catch (Exception e) {e.printStackTrace();}}扫码前端 div idqrImgDiv/divfunction initQrImg() {$(#qrImgDiv).empty();var xmlhttp;xmlhttp new XMLHttpRequest();xmlhttp.open(GET, getQrPath, true);xmlhttp.responseType blob;xmlhttp.onload function () {console.log(this);uuid this.getResponseHeader(uuid);console.log(uuid, uuid);if (this.status 200) {var blob this.response;var img document.createElement(img);img.className qrCodeBox-img;img.onload function (e) {window.URL.revokeObjectURL(img.src);};img.src window.URL.createObjectURL(blob);document.getElementById(qrImgDiv).appendChild(img);}};xmlhttp.send();}
http://www.yutouwan.com/news/271912/

相关文章:

  • 有没有网站建设的教程承德做网站
  • 高端网站建设多少钱湖北省建设厅网站上岗证查询
  • 个人网站做什么类型好重庆建网站cqiezscom
  • 公司网站及微信公众号建设意义好用的外贸网站
  • 网站开发公司盈利wordpress下载链接
  • 网站的网络营销方案建网站浩森宇特
  • 门户网站建设与管理商务网站建设实训报告1600字
  • 桂林市区面积德阳网站怎么做seo
  • 企业网站页面图片三河网站建设-七天网络
  • 适合seo的建站系统wordpress更改默认头像
  • 做爰全过程免费视频网站适合大型网站的流量套餐
  • 网站设计软件免费下载前端培训班一般多少钱
  • 怎么做商业服务网站上海公共招聘网个人简化版
  • 如何通过做网站赚钱python小程序代码
  • 中国制造网网站特色网站建设企业 熊账号
  • 循环视频做网站背景西安有没有网站建设和营销的培训
  • 广州定制网站建设公司已有网站域名 怎么做网站
  • paypal客户端网站建设评价ajax网站开发技术
  • 城镇建设部网站营销网站建设都是专业技术人员吗
  • 家教网站如何建设专业定制网红变色杯
  • 公司建了网站怎么做分录网约车后台平台网站建设
  • 全球搜索网站排名中山软件开发定制
  • 怎样用FW做网站的首页如何写一个微信小程序
  • 营销型网站怎么做做全屏网站图片显示不全
  • 传奇免费网站模板下载网站开发新技术探索
  • 网站APP推广佛山网站建设哪里有
  • 网站开发的后期支持肥西县重点建设局网站
  • 包装设计公司商业模式网站优化seo是什么
  • 西安网站开发的空间刚注册公司怎么做网站
  • 石家庄外贸做网站网站如何做关键词排名