swoole+微信小程序聊天

本文介绍如何利用Swoole的高并发特性,结合微信小程序开发实时聊天功能。通过Swoole的WebSocket服务,实现小程序端与服务器的双向通信,创建高效的聊天体验。
摘要由CSDN通过智能技术生成
<!-- <button bindtap='close'>关闭</button>
<button bindtap='open'>打开</button> -->
<view wx:if='{
   {login}}' class='login_zz'></view>`这里写代码片`
<button wx:if='{
   {login}}' class='login' bindgetuserinfo='userinfo' open-type="getUserInfo">登录</button>
<view class='page_bg' wx:if='{
   {block}}' bindtap='hide_bg' />
<view class='btn_bg' wx:if='{
   {block}}'>
  <view wx:for="{
   {link_list}}" wx:key='index'>
    <button class="sp_tit" id='{
   {index}}' bindtap='list_item'>查看详情 {
  {item}} </button>
  </view>
</view>
<scroll-view class="history" scroll-y="true" scroll-with-animation scroll-top="{
   {scrollTop}}">

  <block wx:key="{
   {index}}" wx:for="{
   {allContentList}}">
    <block wx:if="{
   {item.is_my}}">
      <view class='my_right new_txt'>
        <view class='time' wx:if='{
   {item.messageTime&&item.messageTime!=0}}'>
          {
  {item.messageTime}}
        </view>
        <view class='p_r page_r' style='margin-right: 25rpx;' wx:if='{
   {item.text}}'>
          <view class='new_txt'>
            <view class='new_txt_my'>
              <view class='arrow'>
                <em></em>
                <span></span>
              </view>
              <text decode="true">{
  {item.text}}</text>
            </view>
          </view>
          <image class='new_img' src='{
   {item.avatarUrl}}'></image>
        </view>
        <view class='p_r page_r' style='margin-right: 25rpx;' wx:if='{
   {item.audio}}' bindtap='my_audio_click' data-id='{
   {index}}'>
          <view class='new_txt_my_2' style=' width:{
   {item.length}}px'>
            <image class='my_audio' src='/images/yuyin_icon.png'></image>
          </view>
          <span class='_span'></span>
          <open-data class='new_img' type="userAvatarUrl"></open-data>
        </view>
      </view>
    </block>
    <!-- <view class='you_left' id='id_{
   {allContentList.length}}'> -->
    <block wx:if="{
   {item.is_ai&&item.is_ai!=''}}">
      <view class='you_left' style='width:100%;' id='id_{
   {allContentList.length}}' wx:key="{
   {index}}">
        <view class='time' wx:if='{
   {item.messageTime}}'>
          {
  {item.messageTime}}
        </view>
        <view class='p_r' style='margin-left: 20rpx;'>
          <image class='new_img' src='{
   {item.avatarUrl}}'></image>
          <view class='new_txt'>
            <view class='new_txt_ai'>
              <view class='arrow'>
                <em></em>
                <span></span>
              </view>
              <view class='ai_content'>
                  <!-- <text wx:if='{
   {item.type=="1"}}' decode="true">{
  {item.text}}</text> -->
                  <text  decode="true">{
  {item.text}}</text>
                  <!-- <image wx:if='{
   {item.type=="2"}}' style='width:160rpx;height:160rpx;' src='{
   {item.src}}'></image> -->
              </view>
              <view class='yes_problem_log' wx:if="{
   {item.yse_problem&&item.solve_show}}" style=''>感谢您的反馈,我们会再接再厉!</view>
              <view class='yes_problem_
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值